Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Requests wrongly reusing headers from previous requests? #98

Open
kuikiker opened this issue Feb 6, 2023 · 4 comments
Open

Requests wrongly reusing headers from previous requests? #98

kuikiker opened this issue Feb 6, 2023 · 4 comments
Assignees

Comments

@kuikiker
Copy link

kuikiker commented Feb 6, 2023

I converted a postman collection to K6 but I cannot properly run it. After analysing the HTTP requests with Fiddler I noticed that some requests are wrongly reusing headers from previous requests.
For instance:

  1. Request to /login (user/pass)-> OK (no Content-Type is specified so the default and correct application/x-www-form-urlencoded value is sent).
  2. Request to /endpoint1 using an Authorization bearer header obtained from the previous request. -> OK
  3. Another request to /login (which is a verbatim copy of the first request) -> FAIL, due to wrong headers (Content-Type: application/json & Authorization: Bearer xxxxxxxx) that seems to be coming from the previous request to /endpoint1

Is there something I can do to avoid this behaviour?
I have tried to manually add the Content-Type: application/x-www-form-urlencoded header to the /login requests but the second request to the /login still fails due to the incorrect Authorization: bearer xxxxxxxx header, even though a 'basic' auth is defined for these requests.

Thanks

@thim81
Copy link
Collaborator

thim81 commented Feb 7, 2023

hi @kuikiker

A lot of these things you mentioned often are linked to the Postman collection.
Would it be possible to share the Postman collection (with fake credentials), so we can see what happens in the Postman collection and what K6 scripts are generated.

@kuikiker
Copy link
Author

kuikiker commented Feb 7, 2023

Hi @thim81 ,
I have left the bare minimum of my Postman collection; using fake credentials and only leaving the requests until the second try to /login fails (wrong Content-Type & Authorization headers)

Find attached the Postman collection and the generated K6 script (where I only commented the setTimeout function which is not recognized).

postmanToK6.zip

@thim81
Copy link
Collaborator

thim81 commented Mar 21, 2023

hi @kuikiker
I havent gotten around to look into this, apologies. I hope to find some time in the coming weeks.

@thim81 thim81 self-assigned this Mar 21, 2023
@furiousdog
Copy link

I have the same problem with X-Client-Id header in my scenario. It might only be fixed if I set the value to null.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants