apideck-libraries/postman-to-k6

Requests wrongly reusing headers from previous requests?

kuikiker opened this issue · 14 comments

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

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.

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

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

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.