Skip to content

Commit

Permalink
Only clone headers, not entire interceptedRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
ericclemmons committed Apr 19, 2019
1 parent 186efb8 commit 23fa2f5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Recorder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,13 @@ export class Recorder {
response?: ResponseRecording
) {
// Poor-man's clone for immutability
const request = JSON.parse(JSON.stringify(interceptedRequest));
const { body, headers, method, options } = request;
const headers = JSON.parse(JSON.stringify(interceptedRequest.headers));
const { body, method, options } = interceptedRequest;
const href = this.getHrefFromOptions(options);
const url = new URL(href, true);

// fThis is redundant with `href`, so why should we keep it?
delete request.headers.host;
delete headers.host;

// Remove ephemeral ports from superagent testing
// ! user-agent can be "..." or ["..."]
Expand Down

0 comments on commit 23fa2f5

Please sign in to comment.