Curl gives an error when sending a command to the head

This works fine, no errors:

$ curl -sSL https://coinbase.com/api/v1/prices/historical
2014-04-27T18:19:17-07:00,430.52
2014-04-27T18:10:24-07:00,436.25
2014-04-27T17:56:57-07:00,436.14
...

This results in the following error:

$ curl -sSL https://coinbase.com/api/v1/prices/historical | head -n 1
2014-04-27T18:19:17-07:00,430.52
curl: (23) Failed writing body (0 != 186)

This does not fail when I connect to grepand tail, but it does not fail when I connect to head(even without arguments).

I get what I want, but it gives an error. The last number (186 in the above example) changes every time. I just ran it three more times and got 1650, 3988 and 923.

I tried to launch it using the option -B. If this is helpful, I'm on OSX 10.9. I haven't ~/.curlrc. Here's the conclusion curl --version:

curl 7.30.0 (x86_64-apple-darwin13.0) libcurl/7.30.0 SecureTransport zlib/1.2.5
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IPv6 Largefile NTLM NTLM_WB SSL libz

What is wrong here?

+4
source share
1 answer

head , curl . curl -N, , head :

curl -sNL https://coinbase.com/api/v1/prices/historical | head -n 1
+1

Source: https://habr.com/ru/post/1538332/


All Articles