why is cURL not reading full @file and setting Content-Length: 8186? why is cURL not reading full @file and setting Content-Length: 8186? curl curl

why is cURL not reading full @file and setting Content-Length: 8186?


here's what I had in the end when I finally got it working, in a cmd prompt on Windows 7

curl --request POST ^ --url http://127.0.0.1:8080/MyApp/rest/invoice ^ --header "Content-Type:application/json" ^ --header "Authorization: some-proprietary-auth-code" ^ --header "Content-Length:9905" --header "Expect:" ^ --data-binary "@.\compressedGood.json"

compressedGood.json is a file with un-escaped, double-quoted fields and all spaces and eols removed. Like:

{"externalId":null,"companyName":ACME,"companyProvince":ON,"salesFirstName":null,"salesLastName":null,"products":[ {"name":"Name of Product", ... etc  ... } ] }


Your Content-Length header is ignored by the Transfer-Encoding header.

According to the docs you could try with -H "Transfer-Encoding: identity"