[GH-ISSUE #2066] [feature]: curl can't parse the url without the protocol header correctly. #681

Closed
opened 2026-03-16 16:40:22 +03:00 by kerem · 5 comments
Owner

Originally created by @watchingfun on GitHub (Jan 17, 2022).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2066

Originally assigned to: @kyteinsky on GitHub.

Is there an existing issue for this?

  • I have searched the existing issues

Summary

anwarulislam:bug/body-missing-onimport https://github.com/hoppscotch/hoppscotch/pull/2048
I have cleared the cache and reloaded, but I still can't parse the request body. In addition, I can't parse the url without the protocol header correctly.

Why should this be worked on?

curl -X PUT "localhost:9200/megacorp/employee/1?pretty" -H 'Content-Type: application/json' -d'
{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}
'

Originally created by @watchingfun on GitHub (Jan 17, 2022). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/2066 Originally assigned to: @kyteinsky on GitHub. ### Is there an existing issue for this? - [X] I have searched the existing issues ### Summary anwarulislam:bug/body-missing-onimport https://github.com/hoppscotch/hoppscotch/pull/2048 I have cleared the cache and reloaded, but I still can't parse the request body. In addition, I can't parse the url without the protocol header correctly. ### Why should this be worked on? curl -X PUT "localhost:9200/megacorp/employee/1?pretty" -H 'Content-Type: application/json' -d' { "first_name" : "John", "last_name" : "Smith", "age" : 25, "about" : "I love to go rock climbing", "interests": [ "sports", "music" ] } '
kerem 2026-03-16 16:40:22 +03:00
  • closed this issue
  • added the
    feature
    label
Author
Owner

@liyasthomas commented on GitHub (Jan 17, 2022):

I guess you should add a space between -d and '.

This cURL works for me:

curl -X PUT "localhost:9200/megacorp/employee/1?pretty" \
-H 'Content-Type: application/json' \
-d '{
"first_name" : "John",
"last_name" : "Smith",
"age" : 25,
"about" : "I love to go rock climbing",
"interests": [ "sports", "music" ]
}'

Keeping this issue open to fix origin being null if empty.

<!-- gh-comment-id:1014194607 --> @liyasthomas commented on GitHub (Jan 17, 2022): I guess you should add a space between `-d` and `'`. This cURL works for me: ``` curl -X PUT "localhost:9200/megacorp/employee/1?pretty" \ -H 'Content-Type: application/json' \ -d '{ "first_name" : "John", "last_name" : "Smith", "age" : 25, "about" : "I love to go rock climbing", "interests": [ "sports", "music" ] }' ``` Keeping this issue open to fix `origin` being `null` if empty.
Author
Owner

@watchingfun commented on GitHub (Jan 17, 2022):

sorry, my bad,miss space

<!-- gh-comment-id:1014196411 --> @watchingfun commented on GitHub (Jan 17, 2022): sorry, my bad,miss space
Author
Owner

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

@kyteinsky do you want to pick this issue up ?

<!-- gh-comment-id:1018463609 --> @AndrewBastin commented on GitHub (Jan 21, 2022): @kyteinsky do you want to pick this issue up ?
Author
Owner

@kyteinsky commented on GitHub (Jan 21, 2022):

@kyteinsky do you want to pick this issue up ?

@AndrewBastin

With pleasure.
Just to make sure I understand the issue here, the protocol has to be inferred and prepended if not given, right?

If it's

  • localhost (and local ip?) => http
  • anything else (not mentioned) => https

Keeping this issue open to fix origin being null if empty.

And which origin is being talked about here?

<!-- gh-comment-id:1018470604 --> @kyteinsky commented on GitHub (Jan 21, 2022): > @kyteinsky do you want to pick this issue up ? @AndrewBastin With pleasure.<br>Just to make sure I understand the issue here, the protocol has to be inferred and prepended if not given, right? If it's - localhost (and local ip?) => http - anything else (not mentioned) => https <br> > Keeping this issue open to fix origin being null if empty. And which origin is being talked about here?
Author
Owner

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

@kyteinsky

And which origin is being talked about here?
Its: https://developer.mozilla.org/en-US/docs/Web/API/URL/origin

We use the URL API to parse the URL which gets imported from cURL but it seems to not be working correctly.

Also another possible implementation, we could rewrite the entire cURL Importer system under insomnia-importers which will be more better overall. We can implement it as a separate importer in our new Importer system (refer: https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/helpers/import-export). If you have any doubts, feel free to ping me!

Assuming you are picking this up, I am assigning it to you

<!-- gh-comment-id:1018478687 --> @AndrewBastin commented on GitHub (Jan 21, 2022): @kyteinsky > And which origin is being talked about here? Its: https://developer.mozilla.org/en-US/docs/Web/API/URL/origin We use the URL API to parse the URL which gets imported from cURL but it seems to not be working correctly. Also another possible implementation, we could rewrite the entire cURL Importer system under [insomnia-importers](https://www.npmjs.com/package/insomnia-importers) which will be more better overall. We can implement it as a separate importer in our new Importer system (refer: https://github.com/hoppscotch/hoppscotch/tree/main/packages/hoppscotch-app/helpers/import-export). If you have any doubts, feel free to ping me! Assuming you are picking this up, I am assigning it to you
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#681
No description provided.