问题
Is there any simple way of curl a REST API POST endpoint without a request body? For some reason, the API i am working with is using a endpoint as POST even though its an obvious GET. No Request or HTTP parameters should be added to the request.
The response i get when i do: curl -i -X POST https://APIURL
is:
<BODY><h2>Length Required</h2>
<hr><p>HTTP Error 411. The request must be chunked or have a content length.</p>
</BODY>
回答1:
Add content-length header with your curl request as it is forcing to provide it with request.
-H "Content-Length: 0"
来源:https://stackoverflow.com/questions/43652342/curl-rest-post-endpoint-without-requestbody