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

Wrong cURL code generation for empty string value in header #9212

Closed
edonmustafa opened this issue Oct 29, 2020 · 3 comments · Fixed by postmanlabs/postman-code-generators#408

Comments

@edonmustafa
Copy link

edonmustafa commented Oct 29, 2020

Describe the bug

When a request is made with empty string value in header wrong curl code is generated. It doesn't add ; at the end.

To Reproduce
Steps to reproduce the behavior:

  1. Set request url to localhost/users
  2. Set header field name to tenant and leave it empty
  3. Click code
  4. you will get: curl --location --request GET 'localhost/users' --header 'tenant: '
  5. which should be: curl --location --request GET 'localhost/users' --header 'tenant;'

Expected behavior

curl --location --request GET 'localhost/users' --header 'tenant;'

Screenshots
If applicable, add screenshots to help explain your problem. Please make sure the screenshot does not contain any sensitive information such as API keys or access tokens.

App information (please complete the following information):

  • App Type [Native App]
  • Postman Version [7.34.0]
  • OS: [macOS Catalina 10.15.5]

Additional context
Add any other context about the problem here.

@DannyDainton
Copy link
Contributor

Hey @edonmustafa

Could you expand more on the use case here?

Is this causing you an issue when using that code snippet outside of Postman?

@edonmustafa
Copy link
Author

Hi @DannyDainton

I wanted to show the behaviour of API with empty string in the field "tenant" in header of the request.
We usually share the curl code with the team, so they could replicate the issue.
But got different results, the generated curl code is not what Postman is doing actually.

The generated curl code generates request with field as missing (not included in request).
The Postman app generates a request that includes the field and sets empty value.

So finally you can't use generated code as it is different what Postman is doing actually.

@DannyDainton
Copy link
Contributor

Hey @edonmustafa 👋🏻

I'm going to close this issue due to inactivity - If you're still facing the issue in the latest version we can reopen this and investigate further.

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