[GH-ISSUE #927] [bug] import cURL not working properly #329

Closed
opened 2026-03-16 14:43:57 +03:00 by kerem · 7 comments
Owner

Originally created by @mandaputtra on GitHub (Jun 8, 2020).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/927

Originally assigned to: @AndrewBastin on GitHub.

Describe the bug
Import curl with the Copy as Curl result on browser network tab doesn't really work.

Broken cURL flags:

  • --data-raw
  • --url
  • Importing x-www-form-urlencoded
  • Importing multipart/form-data

To Reproduce
Steps to reproduce the behavior:

  1. Make a request on the browser from your application, POST/PUT request, must had data
  2. Copy the request from browser network pane as Curl
  3. Go to postwoman
  4. Import form curl, the request section are empty

my curl example

curl 'http://127.0.0.1:8000/api/admin/crm/brand/4' -X PUT -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en' --compressed -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9pcmlzLmxvY2FsL2FwaS9hZG1pbi9sb2dpbiIsImlhdCI6MTU2ODIwMjU3OSwiZXhwIjoxNTY4MjA2MTc5LCJuYmYiOjE1NjgyMDI1NzksImp0aSI6IkphUXk1cTFSa0NMeXJyam4ifQ.OoTNsJmERVAozUaWm4K9TRevZHuw1kC6QpWdth0pN2A' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: http://localhost:3012' -H 'Connection: keep-alive' -H 'Referer: http://localhost:3012/crm/company/4' --data-raw '{"id":4,"crm_company_id":4,"industry_primary_id":2,"industry_head_id":2,"industry_body_id":2,"code":"01","barcode":"222010101","summary":"Healt-Seasoning-Basic-Hori-Kello","name":"Kellolaa","sub_code":"01","sub_name":"Hori","created_at":"2020-06-08 08:50:02","updated_at":"2020-06-08 08:50:02","company":4,"primary":{"id":2,"code":"2","name":"Healt","created_at":"2020-05-19 07:05:02","updated_at":"2020-05-19 07:09:28"},"head":{"id":2,"code":"2","name":"Seasoning","created_at":"2020-04-14 19:34:33","updated_at":"2020-04-14 19:34:33"},"body":{"id":2,"code":"2","name":"Basic","created_at":"2020-04-14 19:33:54","updated_at":"2020-04-14 19:33:54"},"contacts":[]}'

Expected behavior
Able import curl from browser pane, the file doesn't matter if it form-url-encoded with file, just make the file null

Desktop (please complete the following information):

  • OS: Ubuntu Latest
  • Browser Firefox
  • Version Latest

Additional context
I stated the problem in other API-testing too, take a look here and here

Originally created by @mandaputtra on GitHub (Jun 8, 2020). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/927 Originally assigned to: @AndrewBastin on GitHub. **Describe the bug** Import curl with the *Copy as Curl* result on browser network tab doesn't really work. Broken cURL flags: - [ ] `--data-raw` - [x] `--url` - [x] Importing `x-www-form-urlencoded` - [ ] Importing `multipart/form-data` **To Reproduce** Steps to reproduce the behavior: 1. Make a request on the browser from your application, POST/PUT request, must had `data` 2. Copy the request from browser network pane as Curl 3. Go to postwoman 4. Import form curl, the `request` section are empty **my curl example** ```bash curl 'http://127.0.0.1:8000/api/admin/crm/brand/4' -X PUT -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en' --compressed -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9pcmlzLmxvY2FsL2FwaS9hZG1pbi9sb2dpbiIsImlhdCI6MTU2ODIwMjU3OSwiZXhwIjoxNTY4MjA2MTc5LCJuYmYiOjE1NjgyMDI1NzksImp0aSI6IkphUXk1cTFSa0NMeXJyam4ifQ.OoTNsJmERVAozUaWm4K9TRevZHuw1kC6QpWdth0pN2A' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: http://localhost:3012' -H 'Connection: keep-alive' -H 'Referer: http://localhost:3012/crm/company/4' --data-raw '{"id":4,"crm_company_id":4,"industry_primary_id":2,"industry_head_id":2,"industry_body_id":2,"code":"01","barcode":"222010101","summary":"Healt-Seasoning-Basic-Hori-Kello","name":"Kellolaa","sub_code":"01","sub_name":"Hori","created_at":"2020-06-08 08:50:02","updated_at":"2020-06-08 08:50:02","company":4,"primary":{"id":2,"code":"2","name":"Healt","created_at":"2020-05-19 07:05:02","updated_at":"2020-05-19 07:09:28"},"head":{"id":2,"code":"2","name":"Seasoning","created_at":"2020-04-14 19:34:33","updated_at":"2020-04-14 19:34:33"},"body":{"id":2,"code":"2","name":"Basic","created_at":"2020-04-14 19:33:54","updated_at":"2020-04-14 19:33:54"},"contacts":[]}' ``` **Expected behavior** Able import curl from browser pane, the file doesn't matter if it `form-url-encoded` with file, just make the file `null` **Desktop (please complete the following information):** - OS: Ubuntu Latest - Browser Firefox - Version Latest **Additional context** I stated the problem in other API-testing too, take a look [here](https://github.com/postmanlabs/postman-app-support/issues/8007) and [here](https://github.com/Kong/insomnia/issues/1934)
kerem 2026-03-16 14:43:57 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@LeoMartinDev commented on GitHub (Oct 4, 2020):

Looks like --data-raw is not supported, please use --data instead which works

curl 'http://127.0.0.1:8000/api/admin/crm/brand/4' -X PUT -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en' --compressed -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9pcmlzLmxvY2FsL2FwaS9hZG1pbi9sb2dpbiIsImlhdCI6MTU2ODIwMjU3OSwiZXhwIjoxNTY4MjA2MTc5LCJuYmYiOjE1NjgyMDI1NzksImp0aSI6IkphUXk1cTFSa0NMeXJyam4ifQ.OoTNsJmERVAozUaWm4K9TRevZHuw1kC6QpWdth0pN2A' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: http://localhost:3012' -H 'Connection: keep-alive' -H 'Referer: http://localhost:3012/crm/company/4' --data '{"id":4,"crm_company_id":4,"industry_primary_id":2,"industry_head_id":2,"industry_body_id":2,"code":"01","barcode":"222010101","summary":"Healt-Seasoning-Basic-Hori-Kello","name":"Kellolaa","sub_code":"01","sub_name":"Hori","created_at":"2020-06-08 08:50:02","updated_at":"2020-06-08 08:50:02","company":4,"primary":{"id":2,"code":"2","name":"Healt","created_at":"2020-05-19 07:05:02","updated_at":"2020-05-19 07:09:28"},"head":{"id":2,"code":"2","name":"Seasoning","created_at":"2020-04-14 19:34:33","updated_at":"2020-04-14 19:34:33"},"body":{"id":2,"code":"2","name":"Basic","created_at":"2020-04-14 19:33:54","updated_at":"2020-04-14 19:33:54"},"contacts":[]}'
`

image

<!-- gh-comment-id:703307803 --> @LeoMartinDev commented on GitHub (Oct 4, 2020): Looks like `--data-raw` is not supported, please use `--data` instead which works `curl 'http://127.0.0.1:8000/api/admin/crm/brand/4' -X PUT -H 'User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0' -H 'Accept: application/json, text/plain, */*' -H 'Accept-Language: en' --compressed -H 'Authorization: Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6Ly9pcmlzLmxvY2FsL2FwaS9hZG1pbi9sb2dpbiIsImlhdCI6MTU2ODIwMjU3OSwiZXhwIjoxNTY4MjA2MTc5LCJuYmYiOjE1NjgyMDI1NzksImp0aSI6IkphUXk1cTFSa0NMeXJyam4ifQ.OoTNsJmERVAozUaWm4K9TRevZHuw1kC6QpWdth0pN2A' -H 'Content-Type: application/json;charset=utf-8' -H 'Origin: http://localhost:3012' -H 'Connection: keep-alive' -H 'Referer: http://localhost:3012/crm/company/4' --data '{"id":4,"crm_company_id":4,"industry_primary_id":2,"industry_head_id":2,"industry_body_id":2,"code":"01","barcode":"222010101","summary":"Healt-Seasoning-Basic-Hori-Kello","name":"Kellolaa","sub_code":"01","sub_name":"Hori","created_at":"2020-06-08 08:50:02","updated_at":"2020-06-08 08:50:02","company":4,"primary":{"id":2,"code":"2","name":"Healt","created_at":"2020-05-19 07:05:02","updated_at":"2020-05-19 07:09:28"},"head":{"id":2,"code":"2","name":"Seasoning","created_at":"2020-04-14 19:34:33","updated_at":"2020-04-14 19:34:33"},"body":{"id":2,"code":"2","name":"Basic","created_at":"2020-04-14 19:33:54","updated_at":"2020-04-14 19:33:54"},"contacts":[]}'` ` ![image](https://user-images.githubusercontent.com/7238941/95025801-bf52e100-068c-11eb-88e2-97bd867ed079.png)
Author
Owner

@liyasthomas commented on GitHub (Oct 5, 2020):

Reopen if there're further issues.

<!-- gh-comment-id:703336100 --> @liyasthomas commented on GitHub (Oct 5, 2020): Reopen if there're further issues.
Author
Owner

@AntonioRedondo commented on GitHub (Nov 30, 2021):

I just came across with this issue. Populating headers from the cURL query works, but not the body payload.

In the below cURL POST HTTP request with content type multipart/form-data the two parameters EmailAddress and Entity of the body payload aren't parsed from the cURL query. And changing --data-raw to --data doesn't fix the issue:

curl 'https://atesturl.com/aPath' \
  -H 'authority: authority.com' \
  -H 'cache-control: max-age=0' \
  -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"' \
  -H 'sec-ch-ua-mobile: ?0' \
  -H 'sec-ch-ua-platform: "Windows"' \
  -H 'upgrade-insecure-requests: 1' \
  -H 'origin: https://someorigin.com' \
  -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryj3oufpIISPa2DP7c' \
  -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 Edg/96.0.1054.29' \
  -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \
  -H 'sec-fetch-site: same-origin' \
  -H 'sec-fetch-mode: navigate' \
  -H 'sec-fetch-user: ?1' \
  -H 'sec-fetch-dest: document' \
  -H 'referer: https://atesturl.com/aPath' \
  -H 'accept-language: en-US,en;q=0.9' \
  -H $'cookie: .AspNetCore.Culture=c%3Den-GB%7Cuic%3Den-GB; .AspNetCore.Session=CfDJ8Fh3EAnbFjZFiXCzedltfrt4zrb%2FPKWd46QP5Q0ogb4bjvxssotETNNbFJzp%2BGfYrCDDVZDfcNoJdYjwWkCdeBQKgp3SkwXK1A4%2B3gvIkU1P9YCl3MTJijQZ%2FL%2FiAawQTmiaLzD2c3ftAtuedcKByeDaLIlne1Y1EouT%2BxWcRY%2Bv; cookieuat=\u00213o2WfZimmfA7YrYk8ntxzlGcC3e5RaGkPQ62q5bRSAHoWJSqtiRNROO0Bl5S8NfDfKKMsLrfeqeTxoE=; ASP.NET_SessionId=aewassr0j23zd24aajctkn12; ATV=3600; Login=Username=test@test.com; ReferrerPlatformSiteId=1; __cf_bm=4jsp8FACoUSj1c3lU.HsDmhEhk65LHXwlH4NL8bmYPk-1638267931-0-AZahBnx8wzgziUkeiPxxGrUEqiMVOsP9Pvs+1IfmNAgw2XNxE4R8XQag41lTqIFIKcPSpb+2O7q0bCqULA2NKclkwlJKIBBFwUREApMrPTQ0' \
  --data-raw $'------WebKitFormBoundaryj3oufpIISPa2DP7c\r\nContent-Disposition: form-data; name="EmailAddress"\r\n\r\ntest@test.com\r\n------WebKitFormBoundaryj3oufpIISPa2DP7c\r\nContent-Disposition: form-data; name="Entity"\r\n\r\n1\r\n------WebKitFormBoundaryj3oufpIISPa2DP7c--\r\n' \
  --compressed
<!-- gh-comment-id:982534421 --> @AntonioRedondo commented on GitHub (Nov 30, 2021): I just came across with this issue. Populating headers from the cURL query works, but not the body payload. In the below cURL POST HTTP request with content type `multipart/form-data` the two parameters `EmailAddress` and `Entity` of the body payload aren't parsed from the cURL query. And changing `--data-raw` to `--data` doesn't fix the issue: ```curl curl 'https://atesturl.com/aPath' \ -H 'authority: authority.com' \ -H 'cache-control: max-age=0' \ -H 'sec-ch-ua: " Not A;Brand";v="99", "Chromium";v="96", "Microsoft Edge";v="96"' \ -H 'sec-ch-ua-mobile: ?0' \ -H 'sec-ch-ua-platform: "Windows"' \ -H 'upgrade-insecure-requests: 1' \ -H 'origin: https://someorigin.com' \ -H 'content-type: multipart/form-data; boundary=----WebKitFormBoundaryj3oufpIISPa2DP7c' \ -H 'user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/96.0.4664.45 Safari/537.36 Edg/96.0.1054.29' \ -H 'accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.9' \ -H 'sec-fetch-site: same-origin' \ -H 'sec-fetch-mode: navigate' \ -H 'sec-fetch-user: ?1' \ -H 'sec-fetch-dest: document' \ -H 'referer: https://atesturl.com/aPath' \ -H 'accept-language: en-US,en;q=0.9' \ -H $'cookie: .AspNetCore.Culture=c%3Den-GB%7Cuic%3Den-GB; .AspNetCore.Session=CfDJ8Fh3EAnbFjZFiXCzedltfrt4zrb%2FPKWd46QP5Q0ogb4bjvxssotETNNbFJzp%2BGfYrCDDVZDfcNoJdYjwWkCdeBQKgp3SkwXK1A4%2B3gvIkU1P9YCl3MTJijQZ%2FL%2FiAawQTmiaLzD2c3ftAtuedcKByeDaLIlne1Y1EouT%2BxWcRY%2Bv; cookieuat=\u00213o2WfZimmfA7YrYk8ntxzlGcC3e5RaGkPQ62q5bRSAHoWJSqtiRNROO0Bl5S8NfDfKKMsLrfeqeTxoE=; ASP.NET_SessionId=aewassr0j23zd24aajctkn12; ATV=3600; Login=Username=test@test.com; ReferrerPlatformSiteId=1; __cf_bm=4jsp8FACoUSj1c3lU.HsDmhEhk65LHXwlH4NL8bmYPk-1638267931-0-AZahBnx8wzgziUkeiPxxGrUEqiMVOsP9Pvs+1IfmNAgw2XNxE4R8XQag41lTqIFIKcPSpb+2O7q0bCqULA2NKclkwlJKIBBFwUREApMrPTQ0' \ --data-raw $'------WebKitFormBoundaryj3oufpIISPa2DP7c\r\nContent-Disposition: form-data; name="EmailAddress"\r\n\r\ntest@test.com\r\n------WebKitFormBoundaryj3oufpIISPa2DP7c\r\nContent-Disposition: form-data; name="Entity"\r\n\r\n1\r\n------WebKitFormBoundaryj3oufpIISPa2DP7c--\r\n' \ --compressed ```
Author
Owner

@nilay1221 commented on GitHub (Dec 9, 2021):

@AntonioRedondo I reproduced the issue but it's working fine for me. Attaching video for the same.

https://user-images.githubusercontent.com/44199023/145417888-2a35c501-4882-485c-8bb7-6da0d703f971.mp4

<!-- gh-comment-id:989981233 --> @nilay1221 commented on GitHub (Dec 9, 2021): @AntonioRedondo I reproduced the issue but it's working fine for me. Attaching video for the same. https://user-images.githubusercontent.com/44199023/145417888-2a35c501-4882-485c-8bb7-6da0d703f971.mp4
Author
Owner

@AntonioRedondo commented on GitHub (Dec 9, 2021):

Hi @nilay1221, thanks for having a look at this issue.

Did you try to import my cURL command into Hoppscotch and see whether the body parameters were populated?

<!-- gh-comment-id:990204760 --> @AntonioRedondo commented on GitHub (Dec 9, 2021): Hi @nilay1221, thanks for having a look at this issue. Did you try to import my cURL command into Hoppscotch and see whether the body parameters were populated?
Author
Owner

@nilay1221 commented on GitHub (Dec 9, 2021):

Hi @nilay1221, thanks for having a look at this issue.

Did you try to import my cURL command into Hoppscotch and see whether the body parameters were populated?

Yes i did and it didn't populate the multipart/form data. Understood your issue. Thank you

<!-- gh-comment-id:990244412 --> @nilay1221 commented on GitHub (Dec 9, 2021): > Hi @nilay1221, thanks for having a look at this issue. > > Did you try to import my cURL command into Hoppscotch and see whether the body parameters were populated? Yes i did and it didn't populate the multipart/form data. Understood your issue. Thank you
Author
Owner

@AndrewBastin commented on GitHub (Jan 27, 2022):

@kyteinsky can you look into this on your PR as well ?

<!-- gh-comment-id:1023181599 --> @AndrewBastin commented on GitHub (Jan 27, 2022): @kyteinsky can you look into this on your PR as well ?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#329
No description provided.