Skip to content
This repository has been archived by the owner on Nov 23, 2021. It is now read-only.

Missing autogenerated headers #82

Closed
Eomm opened this issue Feb 26, 2021 · 1 comment
Closed

Missing autogenerated headers #82

Eomm opened this issue Feb 26, 2021 · 1 comment

Comments

@Eomm
Copy link

Eomm commented Feb 26, 2021

Postman adds by default the 'Content-Type': 'application/json' on POST with a json body.

This header is not evaluated on k6 script generation.
Could it be possible to add it?
Could you guide me through the code?

Thanks

@simskij
Copy link
Contributor

simskij commented Apr 22, 2021

Definitely! Just add it to the request object, like this:

    postman[Request]({
      name: "DELETE Request",
      id: "f167509c-88df-4965-8ede-30d376b71bd4",
      method: "DELETE",
      address: "https://postman-echo.com/delete",
      data: "test",
+     headers: {
+       "Content-Type": "application/json"
+     }
});

You may even add the header explicitly in postman prior to converting your collection.

Hope that helps!

Best,
Simme

@simskij simskij closed this as completed Apr 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants