Skip to content

Commit 0ad7a11

Browse files
authored
Add custom agent support
1 parent 37de70b commit 0ad7a11

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@ wwwroot/*.js
22
node_modules
33
typings
44
dist
5+
.DS_Store
56

67
.idea
78
.vscode
89
.history
10+
.npmrc

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pandadoc-node-client",
3-
"version": "4.3.0",
3+
"version": "4.3.1",
44
"description": "The Official PandaDoc Node client SDK",
55
"author": "PandaDoc",
66
"keywords": [

src/http/http.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
// TODO: evaluate if we can easily get rid of this library
22
import * as FormData from "form-data";
33
import { URLSearchParams } from 'url';
4+
import * as http from 'http';
5+
import * as https from 'https';
46
// typings of url-parse are incorrect...
57
// @ts-ignore
68
import * as URLParse from "url-parse";
@@ -48,10 +50,11 @@ export type RequestBody = undefined | string | FormData | URLSearchParams;
4850
*/
4951
export class RequestContext {
5052
private headers: { [key: string]: string } = {
51-
"User-Agent": "pandadoc_node_client/4.3.0",
53+
"User-Agent": "pandadoc_node_client/4.3.1",
5254
};
5355
private body: RequestBody = undefined;
5456
private url: URLParse;
57+
private agent: http.Agent | https.Agent | undefined = undefined;
5558

5659
/**
5760
* Creates the request context using a http method and request resource url
@@ -124,6 +127,14 @@ export class RequestContext {
124127
public setHeaderParam(key: string, value: string): void {
125128
this.headers[key] = value;
126129
}
130+
131+
public setAgent(agent: http.Agent | https.Agent) {
132+
this.agent = agent;
133+
}
134+
135+
public getAgent(): http.Agent | https.Agent | undefined {
136+
return this.agent;
137+
}
127138
}
128139

129140
export interface ResponseBody {

0 commit comments

Comments
 (0)