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 import #7390

Closed
m3dbedb opened this issue Sep 26, 2019 · 4 comments
Closed

Wrong curl import #7390

m3dbedb opened this issue Sep 26, 2019 · 4 comments

Comments

@m3dbedb
Copy link

m3dbedb commented Sep 26, 2019

Describe the bug
Postman parses culr body imported as raw text to URL

To Reproduce
Steps to reproduce the behavior:

  1. Press import button
  2. Click on Raw text tab
  3. paste text
    curl -i http://192.168.0.1:8084/api/v1/crontab -d '{
    "name": "test10",
    "description": "тестовое расписание",
    "start": "2 * * * *",
    "enable": true,
    "command":"startTariff",
    "param":"[123]"
    }'
  4. See error. URL is lost, body goes to request URL

Expected behavior
In previous version 7.x.x Postman imported curl commands correctly, URL -i http://192.168.0.1:8084/api/v1/crontab appears in Request URL, -d '{ "name": "test10", "description": "тестовое расписание", "start": "2 * * * *", "enable": true, "command":"startTariff", "param":"[123]" }' was moved to Request body.

Screenshots
applied
curl

App information

  • Native App
  • Postman 7.8.0
  • OS: win7 32 bit
@abhijitkane
Copy link
Member

Thanks @m3dbedb - we'll aim to get a fix out soon.

@m3dbedb
Copy link
Author

m3dbedb commented Nov 13, 2019

the issue in present in postman 7.11

@m3dbedb
Copy link
Author

m3dbedb commented Feb 18, 2020

In postman 7.18.1 for windows 7 32 bit curl body imports to x-www-form-urlencoded key, and recipient does not understand it

curl -i http://localhost:8084/api/v1/a -d '{
"name":"test1",
"description":"тест 1"
}'

result

curl -L -X POST 'http://localhost:8084/api/v1/a' -H 'Content-Type: application/x- www-form-urlencoded' --data-urlencode '{
"name":"test1",
"description":"тест 1"
}='

I suppose curl body should be imported as raw text:

curl -L -X POST 'http://localhost:8084/api/v1/a' --data-raw '{
"name":"test1",
"description":"тест 1"
}'

@abhijitkane
Copy link
Member

@m3dbedb The default interpretation of -d is the urlencoded mode.
Sending this:

curl -i http://postman-echo.com/post -d '{
"name":"test1",
"description":"тест 1"
}'

through the command line will send the JSON as the urlencoded key.

As you suggested, specifying --data-raw and the json content type works:

curl 'https://postman-echo.com/post' --data-raw '{"name":"test1","description":"тест 1"}' --header 'Content-Type: application/json'

Closing this issue - Postman's behavior is at par with the curl CLI.

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

No branches or pull requests

2 participants