无法在postman发送post请求post

来源:2-7 编码实战:实现文件修改接口+小结

拧壶冲

2020-10-16

使用postman发送post request,结果r.method是“GET”。我记得好像需要加一个什么设置。但是忘记了,也没有找到相关信息

写回答

2回答

拧壶冲

提问者

2020-10-16

根本原因是chrome将一部分内容cached了,导致 file/upload 会被跳转到 file/upload/。

把chrome的image和file的cache清空一下就正常了。

0
0

拧壶冲

提问者

2020-10-16

解决了。

Patterns name fixed, rooted paths, like "/favicon.ico", or rooted subtrees, like "/images/" (note the trailing slash). Longer patterns take precedence over shorter ones, so that if there are handlers registered for both "/images/" and "/images/thumbnails/", the latter handler will be called for paths beginning "/images/thumbnails/" and the former will receive requests for any other paths in the "/images/" subtree.

If a subtree has been registered and a request is received naming the subtree root without its trailing slash, ServeMux redirects that request to the subtree root (adding the trailing slash). This behavior can be overridden with a separate registration for the path without the trailing slash. For example, registering "/images/" causes ServeMux to redirect a request for "/images" to "/images/", unless "/images" has been registered separately.

看了下文档,因为我结尾带了tailing slash,导致了redirect request。

0
0

Go实战仿百度云盘-实现企业级分布式云存储系统

紧随“云时代”技术潮流,分布式云存储系统,做第一代云程序员

1077 学习 · 494 问题

查看课程