Skip to content

Commit

Permalink
merge headers
Browse files Browse the repository at this point in the history
  • Loading branch information
soulgalore committed Jun 23, 2024
1 parent 531690c commit d569cde
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions lib/firefox/firefoxBidi.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,7 @@ export class FirefoxBidi {
};
const bidi = new Bidi(this.driver, this.options.browser);

const res = await bidi.send(command);
log.info(res);
await bidi.send(command);
await bidi.subscribe('network.beforeRequestSent');
await bidi.onMessage(async function (event) {
const parsedEvent = JSON.parse(Buffer.from(event.toString()));
Expand All @@ -186,17 +185,13 @@ export class FirefoxBidi {
method: 'network.continueRequest',
params: {
request: parsedEvent.params.request.request,
headers
headers: [...parsedEvent.params.request.headers, ...headers]
}
};
const result = await bidi.send(continueRequest);
if (result.type == 'success') {
log.info(result);
} else {
if (result.type != 'success') {
log.error(result);
}
} else {
log.info(parsedEvent.method);
}
});
}
Expand Down

0 comments on commit d569cde

Please sign in to comment.