insomnia
insomnia copied to clipboard
Unable to paste curl to URL address if multi-line character / is present
I have a curl
curl --request PUT \ --url 'http://localhost:8080/orders/123/statuses?_t=1610601816796' \ --header 'Accept: application/json, text/plain, */*' \ --header 'Accept-Language: en-US,en;q=0.9' \ --header 'Authorization: Bearer v' \ --header 'Connection: keep-alive' \ --header 'Content-Type: application/json;charset=UTF-8' \ --header 'Sec-Fetch-Dest: empty' \ --header 'Sec-Fetch-Mode: cors' \ --header 'Sec-Fetch-Site: cross-site' \ --header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36' \ --header 'tz: 0' \ --data '{ "value": "TESTED" }'
- I want to use this curl to make a new request (Paste this curl into URL bar), but I have to do it the second time to work
Thank you!
I can replicate the issue, on my instance it also does not properly import as well. After some debugging looks like the issue stems from the multi-line character /
, after removing and doing the same action (pasting into the URL bar) it works as intended.
curl --request PUT --url 'http://localhost:8080/orders/123/statuses?_t=1610601816796' --header 'Accept: application/json, text/plain, */*' --header 'Accept-Language: en-US,en;q=0.9' --header 'Authorization: Bearer v' --header 'Connection: keep-alive' --header 'Content-Type: application/json;charset=UTF-8' --header 'Sec-Fetch-Dest: empty' --header 'Sec-Fetch-Mode: cors' --header 'Sec-Fetch-Site: cross-site' --header 'User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36' --header 'tz: 0' --data '{ "value": "TESTED" }'
This seems like a UI bug - a unit test exists which contains the multi-line character, and it behaves in the same way described above. Partly imports after the first paste, fully imports after the second paste.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
Thank you for reporting the issue regarding the inability to paste a curl command with a multi-line character ("/") into the URL address. This problem can occur when the command spans multiple lines, causing an error when attempting to paste it.
To resolve this issue, we recommend using an alternative method to execute the curl command. You can save the command as a script in a text file and then execute the script in your terminal. Here's how you can do it:
- Open a text editor and create a new file.
- Paste the entire curl command into the file, ensuring it is in a single line.
- Save the file with a meaningful name, such as
script.sh
. - Open your terminal and navigate to the directory where the script is saved.
- Run the script by typing
sh script.sh
or./script.sh
in the terminal.
Using this approach, you can execute the curl command without encountering any issues related to multi-line characters when pasting into the URL address.
Here is an example of how the script may look:
#!/bin/sh
# Replace this with your actual curl command
curl -X GET "https://api.example.com/endpoint" \
-H "Authorization: Bearer TOKEN" \
-H "Content-Type: application/json" \
-d '{
"param1": "value1",
"param2": "value2"
}'
This error is persistent, and it is also happening now on single line curls, which is making it impossible for me to utilize Insomnia seamlessly as a tool during development.
Thank you for reporting the issue regarding the inability to paste a curl command with a multi-line character ("/") into the URL address. This problem can occur when the command spans multiple lines, causing an error when attempting to paste it.
To resolve this issue, we recommend using an alternative method to execute the curl command. You can save the command as a script in a text file and then execute the script in your terminal. Here's how you can do it: ...
Why anyone would go though all this trouble run a curl they already have in text format? The problem from the original poster is that they are unable to paste a curl into the URL field on Insomnia and have insomnia automatically parse it and initialize it so they are able to run it inside insomnia without having to go thorugh the trouble of clicking a context menu, selecting import curl, paste it in the window and save, Insomnia has for years worked accepting a curl directly into the URL field of any request, then it parsed it normally, thats the behavior we want working, and it used to work with both single line and multline curls.
This error is persistent, and it is also happening now on single line curls, which is making it impossible for me to utilize Insomnia seamlessly as a tool during development.
Thank you for reporting the issue regarding the inability to paste a curl command with a multi-line character ("/") into the URL address. This problem can occur when the command spans multiple lines, causing an error when attempting to paste it. To resolve this issue, we recommend using an alternative method to execute the curl command. You can save the command as a script in a text file and then execute the script in your terminal. Here's how you can do it: ...
Why anyone would go though all this trouble run a curl they already have in text format? The problem from the original poster is that they are unable to paste a curl into the URL field on Insomnia and have insomnia automatically parse it and initialize it so they are able to run it inside insomnia without having to go thorugh the trouble of clicking a context menu, selecting import curl, paste it in the window and save, Insomnia has for years worked accepting a curl directly into the URL field of any request, then it parsed it normally, thats the behavior we want working, and it used to work with both single line and multline curls.
This is no longer working for me as well after latest update. I heavily used this feature.
I had to rollback to a previous 2023.4.x version to have access to this feature back, and then I disabled the auto-update feature, because this is just too important for my workflow
this should be resolved in #6500