<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Ruslan&#39;s Tech Blog</title>
    <link>https://blog.bekenev.net/tags/curl.html</link>
    <description>Software development related stuff</description>
    <language>en-us</language>
    <lastBuildDate>Fri, 23 Mar 2018 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://blog.bekenev.net/tags/curl/feed.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>CURL get formatted JSON</title>
      <link>https://blog.bekenev.net/2018/03/23/format-curl-json.html</link>
      <pubDate>Fri, 23 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2018/03/23/format-curl-json.html</guid>
      <description>&lt;p&gt;Hey,&lt;/p&gt;&#xA;&lt;p&gt;Sometimes I check HTTP responses with CURL so it would be great to format JSON responses.&lt;/p&gt;&#xA;&lt;p&gt;There is cool &lt;a target=&#34;_blank&#34; href=&#34;https://stedolan.github.io/jq/&#34;&gt;command line JSON parser&lt;/a&gt; and you can pipe CURL output to it like that:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;curl http://some.endpoint/with-json-response | jq &#39;.&#39;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;I&amp;rsquo;ve wrote useful function called &lt;code&gt;jcurl&lt;/code&gt; that is basically wrapper on that command above:&lt;/p&gt;&#xA;&lt;pre tabindex=&#34;0&#34;&gt;&lt;code&gt;function jcurl() {&#xA;    curl &amp;#34;$@&amp;#34; | jq &amp;#39;.&amp;#39;&#xA;}&#xA;&lt;/code&gt;&lt;/pre&gt;&lt;br/&gt;&#xA;&lt;p&gt;P.S.&#xA;Don&amp;rsquo;t forget to source your &lt;code&gt;(bash|zsh|any)rc&lt;/code&gt;.&lt;/p&gt;&#xA;</description>
    </item>
    <item>
      <title>Disable CURL&#39;s globbing parser</title>
      <link>https://blog.bekenev.net/2018/03/23/disable-curl-globbing-parser.html</link>
      <pubDate>Fri, 23 Mar 2018 00:00:00 +0000</pubDate>
      <guid>https://blog.bekenev.net/2018/03/23/disable-curl-globbing-parser.html</guid>
      <description>&lt;p&gt;Hey. Recently I&amp;rsquo;ve tried to CURL something like this:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;curl &#39;http://localhost?q[param]=value&#39;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;and I got &lt;code&gt;[globbing] bad range in column&lt;/code&gt; error from CURL.&#xA;This one is unexpected since I was thinking that using single quotes&#xA;do not require any escaping. To find a workaround you can check &lt;code&gt;man curl&lt;/code&gt; and&#xA;seek for &lt;code&gt;globbing&lt;/code&gt;.&lt;/p&gt;&#xA;&lt;p&gt;So the solution is &lt;code&gt;-g&lt;/code&gt; option:&lt;/p&gt;&#xA;&lt;p&gt;&lt;code&gt;curl -g &#39;http://localhost?q[param]=value&#39;&lt;/code&gt;&lt;/p&gt;&#xA;&lt;p&gt;P.S.&lt;/p&gt;&#xA;&lt;p&gt;Sure you can manually escape square brackets but if your url is pretty long&#xA;it can take some time.&lt;/p&gt;&#xA;</description>
    </item>
  </channel>
</rss>
