Skip to content

Commit

Permalink
fix: Puppeteer CORS request matching (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
offirgolan authored Sep 15, 2018
1 parent 3f5f5b2 commit 7831115
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/@pollyjs/adapter-puppeteer/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,13 +70,15 @@ export default class PuppeteerAdapter extends Adapter {

// If this is a polly passthrough request
// Get the associated promise object for the request id and set it
// on the request
this._requestsMapping.passthroughs.set(
request,
this[PASSTHROUGH_PROMISES].get(
parsedUrl.query[PASSTHROUGH_REQ_ID_QP]
)
);
// on the request.
if (!isPreFlightReq) {
this._requestsMapping.passthroughs.set(
request,
this[PASSTHROUGH_PROMISES].get(
parsedUrl.query[PASSTHROUGH_REQ_ID_QP]
)
);
}

// Delete the query param to remove any pollyjs footprint
delete parsedUrl.query[PASSTHROUGH_REQ_ID_QP];
Expand Down Expand Up @@ -231,6 +233,7 @@ export default class PuppeteerAdapter extends Adapter {
await response.text()
);
} catch (error) {
console.error(error);
throw error;
} finally {
this[PASSTHROUGH_PROMISES].delete(requestId);
Expand Down

0 comments on commit 7831115

Please sign in to comment.