Skip to content

Commit

Permalink
Recursively collect delegate headers to include in fetch request
Browse files Browse the repository at this point in the history
  • Loading branch information
tleish committed Jan 15, 2021
1 parent 178c817 commit f3d413a
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/http/fetch_request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,11 +130,14 @@ export class FetchRequest {
}

get additionalHeaders() {
if (typeof this.delegate.additionalHeadersForRequest == "function") {
return this.delegate.additionalHeadersForRequest(this)
} else {
return {}
let headers = {};
let rootDelegate:any = this;
while(rootDelegate = rootDelegate.delegate) {
if (typeof rootDelegate.additionalHeadersForRequest == "function") {
headers = Object.assign(rootDelegate.additionalHeadersForRequest(this), headers);
}
}
return headers;
}

get abortSignal() {
Expand Down

0 comments on commit f3d413a

Please sign in to comment.