袅袅不按位置后

袅袅不按位置后

问题描述:

后,我有一个REST API与后续的端点:袅袅不按位置后

curl -L -H "Content-Type: application/json" -X POST -d "{\"source\" : \"3\", \"destination\" : \"5\"}" "http://localhost:8080/api/edge" |cjson 

这一要求不使后门柱位置URL(返回null,在这种情况下,我使用格式输出的cjson)。如果在帖子后使用类似postman的工具,则正确的重定向完成。

这里使用-i选项:提前

curl -i -H "Content-Type: application/json" -X POST -d "{\"source\" : \"3\", \"destination\" : \"5\"}" "http://localhost:8080/api/edge" 

HTTP/1.1 303 See Other 
Date: Sun, 27 Sep 2015 01:39:40 GMT 
Location: http://localhost:8080/api/customer 
Vary: Accept 
Content-Type: application/json;charset=ISO-8859-1 
Content-Length: 0 
Server: Jetty(7.6.8.v20121106) 

感谢

使用-post303选项,以确保获得一个POST消息的HTTP 303响应后,它将再次当它使用POST遵循重定向,所以:

curl -L -post303 -H "Content-Type: application/json" -X POST -d "{\"source\" : \"3\", \"destination\" : \"5\"}" "http://localhost:8080/api/edge" |cjson