今天做一个测试,利用命令行下curl命令发送post请求,后台是springmvc,我的命令书写出了点差错。
curl -X post --data "lpsust=ZAgAAAAAAAGE9MTAwNTg2NTc0ODAmYj0xJmM9NCZkPTExNDA4JmU9RkM2ODgxODAxMDVGNj
E4OEQzOUM5Nzk1NjY2MkJCRTgxJmg9MTQ4OTU0NDAyMTI5MCZpPTEyMDk2MDAmaj0wJmlsPWNuLq4bz7sOwB
S1X4dKb-QmOA&pkgname=com.hgqn.unbeatablepigman.le
novo" http://10.103.94.96:8080/luckydraw/reserve/notify.json
结果就报了错:
org.springframework.web.servlet.mvc.support.DefaultHandlerExceptionResolver.handleHttpRequestMethodNotSupported(210)
| Request method 'post' not supported
出现这个错,提示很明显Request method 'post' not supported。springmvc收到了这样的请求,但是在做方法类型判断时不支持小写。
通过curl发请求,标准写法是 post,get,delete,put等需要大写,原来springmvc对方法类型大小写很敏感。
正确写法:
改正之后再次做操作就成功。