CURL Rest POST endpoint without requestbody

空扰寡人 提交于 2021-01-28 10:52:01

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!