You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to write some tests around endpoint authentication and I noticed that using I.haveRequestHeaders caused subsequent scenarios to include those headers when making get requests.
What do you get instead?
I see that later tests inherit headers from earlier tests even when resetHeaders is true.
Provide console output if related. Use --verbose mode for more details.
$ codeceptjs run --steps
CodeceptJS v1.0.3
Using test root "/home/alex/workspace/codecept-headers"
Repro test --
with headers
• I have request headers {"Authorization":"Bearer validToken"}
• I send get request "/ping"
request headers { Authorization: 'Bearer validToken', 'content-length': 0 }
✓ OK in 28ms
without headers
• I send get request "/ping"
request headers { Authorization: 'Bearer validToken', 'content-length': 0 }
✖ FAILED in 4ms
-- FAILURES:
1) Repro test: without headers:
'Bearer validToken' == undefined
Run with --verbose flag to see NodeJS stacktrace
FAIL | 1 passed, 1 failed // 48ms
error Command failed with exit code 1.
Running the test without the authorization header first fixed the issue, but I ultimately decided to pass the headers along with every sendGetRequest instead of using haveRequestHeaders.
The text was updated successfully, but these errors were encountered:
What are you trying to achieve?
I was trying to write some tests around endpoint authentication and I noticed that using
I.haveRequestHeaders
caused subsequent scenarios to include those headers when making get requests.What do you get instead?
I see that later tests inherit headers from earlier tests even when
resetHeaders
is true.Details
CodeceptJS version: 1.0.3
NodeJS Version: v8.8.0
Operating System: Ubuntu 16.04 Xenial
Unirest: 0.5.1
Configuration file:
I also have a repo with a tiny Hapi server that reproduces the issue and includes my bootstrap code: https://github.com/alexashley/codecept-headers
Running the test without the authorization header first fixed the issue, but I ultimately decided to pass the headers along with every
sendGetRequest
instead of usinghaveRequestHeaders
.The text was updated successfully, but these errors were encountered: