taiko icon indicating copy to clipboard operation
taiko copied to clipboard

Request interception does not pass original request headers

Open arijit91 opened this issue 4 years ago • 2 comments

Describe the bug Request interception when headers passed as navigation options does not pass on original request headers

Server uses basic http auth and another endpoint requires Accept headers. I passed the Authorization headers for basic auth, future requests were missing the Accept header that should be set automatically by the browser

To Reproduce Created a simple HTTP server with basic auth and verify that Taiko does not receive the Accept header passed by the browser

Expected behavior Taiko should pass on original request headers in addition to the headers passed as navigation options

Versions: Taiko: 1.28

Additional context Was able to get my workflow passing with this patch in the fetch handler:

ubuntu@ip-172-31-17-108:~/relicx$ diff ts/node_modules/taiko/lib/handlers/fetchHandler.js /usr/local/lib/node_modules/taiko/lib/handlers/fetchHandler.js 44a45,48

options.headers = {} for (const headerName in p.request.headers) { options.headers[headerName] = p.request.headers[headerName]; } 47d50 < options.headers = options.headers || {};

Can send a fix for this if this is not the intended behaviour

arijit91 avatar Mar 09 '22 12:03 arijit91

The patch to pass original parameters makes sense. Please feel free to raise a pull request (and a test to cover this scenario)

zabil avatar Mar 10 '22 13:03 zabil

@arijit91 could you raise a pr to fix this issue?

florarao2022 avatar Mar 14 '23 12:03 florarao2022