Skip to content

Commit

Permalink
add getRequestURL
Browse files Browse the repository at this point in the history
  • Loading branch information
melgish committed Jun 7, 2020
1 parent ca97ae8 commit 58f13c3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion src/OBatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export class OBatch {
"Content-Transfer-Encoding: binary",
`Content-ID: ${contentId}`,
"",
`${req.config.method} ${req.url.href} HTTP/1.1`,
`${req.config.method} ${this.getRequestURL(req)} HTTP/1.1`,
`${this.getHeaders(req)}`,
`${this.getBody(req)}`
].join(CRLF);
Expand Down Expand Up @@ -172,4 +172,13 @@ export class OBatch {
}
return mapped.join(CRLF);
}

private getRequestURL(req: ORequest): string {
let href = req.url.href;
if (this.batchConfig.batch.useRelativeURLs) {
// Strip away matching root from request.
href = href.replace(this.batchConfig.rootUrl.href, '');
}
return href;
}
}

0 comments on commit 58f13c3

Please sign in to comment.