Troubleshooting of curl errors: Difference between revisions
Jump to navigation
Jump to search
→Further reading
mNo edit summary |
|||
| Line 85: | Line 85: | ||
Solution | Solution | ||
* Double quote the {{kbd | key=<nowiki>URL</nowiki>}} e.g. {{kbd | key=<nowiki>curl "http://website.test/http_status.php?case=500"</nowiki>}} | * Double quote the {{kbd | key=<nowiki>URL</nowiki>}} e.g. {{kbd | key=<nowiki>curl "http://website.test/http_status.php?case=500"</nowiki>}} | ||
== How to resolve the error: zsh: parse error near `&' == | |||
Error condition | |||
<pre> | |||
% curl -XPOST http://localhost:3000/ -H "Content-Type: application/json" -d'{"url": "https://someweb.com/Today's_Biggest_Trends"}' | |||
dquote> | |||
</pre> | |||
Solution: Escape the single quote {{kbd | key=<nowiki>'</nowiki>}} became {{kbd | key=<nowiki>''</nowiki>}} (repeat the single quote twice) | |||
<pre> | |||
% curl -XPOST http://localhost:3000/ -H "Content-Type: application/json" -d'{"url": "https://someweb.com/Today''s_Biggest_Trends"}' | |||
</pre> | |||
Trivial Solution {{exclaim}} '''NOT WORK''': single quote {{kbd | key=<nowiki>'</nowiki>}} became {{kbd | key=<nowiki>\'</nowiki>}} | |||
<pre> | |||
% curl -XPOST http://localhost:3000/ -H "Content-Type: application/json" -d'{"url": "https://someweb.com/Today\'s_Biggest_Trends"}' | |||
dquote> | |||
</pre> | |||
== Further reading == | == Further reading == | ||
* [https://ec.haxx.se/ Introduction - Everything curl] | * [https://ec.haxx.se/ Introduction - Everything curl] | ||
* [https://curl.haxx.se/docs/manpage.html curl - How To Use] | * [https://curl.haxx.se/docs/manpage.html curl - How To Use] | ||
* [https://stackoverflow.com/questions/32122586/curl-escape-single-quote bash - CURL escape single quote - Stack Overflow] | |||
== References == | == References == | ||