Skip to content

Commit

Permalink
Merge pull request #3 from hlxjs/issues/support-proxy-agent
Browse files Browse the repository at this point in the history
Support proxy agent
  • Loading branch information
kuu committed Jul 11, 2019
2 parents f3ac31e + b3da7a5 commit a42e5c7
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions writer.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ const {getPathFromUrl, getPath, createUrl} = require('./util');
const print = debug('hlx-http-put');

class HttpPutWriter {
constructor({endpoint, rootPath = getPathFromUrl(endpoint)}) {
constructor({endpoint, rootPath = getPathFromUrl(endpoint), agent}) {
this.endpoint = endpoint;
this.rootPath = rootPath;
this.agent = agent;
if (!path.isAbsolute(rootPath)) {
rootPath = path.join('/', rootPath);
}
Expand Down Expand Up @@ -45,7 +46,8 @@ class HttpPutWriter {
return fetch(url, {
method: 'PUT',
body: data,
headers: {'Content-Type': mimeType}
headers: {'Content-Type': mimeType},
agent: this.agent
})
.then(() => url);
}
Expand Down

0 comments on commit a42e5c7

Please sign in to comment.