Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: scerdal/typed-rest-client
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: microsoft/typed-rest-client
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 3 commits
  • 17 files changed
  • 3 contributors

Commits on Sep 9, 2024

  1. Migration to CFS (microsoft#377)

    * Migration to CFS
    
    * Add NpmAuthenticate@0 task before the installation task
    ivanduplenskikh authored Sep 9, 2024
    Copy the full SHA
    7654878 View commit details

Commits on Sep 19, 2024

  1. Add ability to pass global agent options for HttpClient (microsoft#378

    )
    
    * Increase timeout for global agent
    
    * Add ability to pass global agent options to http client constructor
    
    * Update version in test projects
    
    ---------
    
    Co-authored-by: v-levockina <undefined>
    aleksandrlevochkin authored Sep 19, 2024
    Copy the full SHA
    92f407b View commit details

Commits on Jan 17, 2025

  1. Updating CODEOWNERS ad fixing build (microsoft#383)

    * Update CODEOWNERS
    
    * Fixing os name for tests to pass
    tarunramsinghani authored Jan 17, 2025
    Copy the full SHA
    f717982 View commit details
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# Global rule:
* @microsoft/akvelon-build-task-team @microsoft/azure-pipelines-platform
* @microsoft/azure-pipelines-tasks-and-agent @microsoft/azure-pipelines-platform
3 changes: 3 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
registry=https://pkgs.dev.azure.com/mseng/PipelineTools/_packaging/PipelineTools_PublicPackages/npm/registry/

always-auth=true
7 changes: 5 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ parameters:
type: object
default:
windows: 'abtt-windows-2022'
ubuntu: 'abtt-ubuntu-2204'
linux: 'abtt-ubuntu-2204'
- name: publishToNpm
displayName: Publish to npm
type: boolean
@@ -60,6 +60,9 @@ extends:
inputs:
versionSpec: '20.x'
displayName: Install node 20.x
- task: NpmAuthenticate@0
inputs:
workingFile: .npmrc
- script: npm install
displayName: npm install
- script: npm run build
@@ -125,4 +128,4 @@ extends:
env:
GH_TOKEN: $(githubToken)
branch: $(Build.SourceBranchName)
displayName: Create Release
displayName: Create Release
14 changes: 13 additions & 1 deletion lib/HttpClient.ts
Original file line number Diff line number Diff line change
@@ -121,6 +121,10 @@ export class HttpClient implements ifm.IHttpClient {
private _ca: string;
private _cert: string;
private _key: string;
private _httpGlobalAgentOptions: ifm.IHttpGlobalAgentOptions = {
keepAlive: false,
timeout: 30_000
};

constructor(userAgent: string | null | undefined, handlers?: ifm.IRequestHandler[], requestOptions?: ifm.IRequestOptions) {
this.userAgent = userAgent;
@@ -148,6 +152,10 @@ export class HttpClient implements ifm.IHttpClient {
});
}

if (requestOptions.globalAgentOptions) {
this._httpGlobalAgentOptions = requestOptions.globalAgentOptions;
}

this._certConfig = requestOptions.cert;

if (this._certConfig) {
@@ -529,7 +537,11 @@ export class HttpClient implements ifm.IHttpClient {

// if not using private agent and tunnel agent isn't setup then use global agent
if (!agent) {
agent = usingSsl ? https.globalAgent : http.globalAgent;
const globalAgentOptions: http.AgentOptions = {
keepAlive: this._httpGlobalAgentOptions.keepAlive,
timeout: this._httpGlobalAgentOptions.timeout
};
agent = usingSsl ? new https.Agent(globalAgentOptions) : new http.Agent(globalAgentOptions);
}

if (usingSsl && this._ignoreSslError) {
6 changes: 6 additions & 0 deletions lib/Interfaces.ts
Original file line number Diff line number Diff line change
@@ -47,6 +47,7 @@ export interface IRequestOptions {
ignoreSslError?: boolean;
proxy?: IProxyConfiguration;
cert?: ICertConfiguration;
globalAgentOptions?: IHttpGlobalAgentOptions;
allowRedirects?: boolean;
allowRedirectDowngrade?: boolean;
maxRedirects?: number;
@@ -72,6 +73,11 @@ export interface ICertConfiguration {
passphrase?: string;
}

export interface IHttpGlobalAgentOptions {
keepAlive?: boolean;
timeout?: number;
}

export interface IRequestQueryParams {
options?: {
separator?: string,
Loading