V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
46fo

关于 go 的 http post 请求重定向后变成 get 请求问题。

  •  
  •   46fo · Mar 3, 2021 · 1103 views
    This topic created in 1882 days ago, the information mentioned may be changed or developed.
    对于 301 、302 、303 的状态码, 接下来转发的请求会将请求 Method 转换成 GET method (如果原始请求 Method 是 HEAD 则不变,还是 HEAD), 而且 body 为空, 尽管原始的请求可能包含 body 。https://colobu.com/2017/04/19/go-http-redirect/

    我就是遇到这个问题了,想问下各位高手怎么样设置才能像 curl 的 CURL_REDIR_POST_ALL 选项一样重定向后保持 post 请求和 body 啊。
    3 replies    2021-03-16 19:10:12 +08:00
    46fo
        1
    46fo  
    OP
       Mar 5, 2021
    没有人遇到过吗?
    yeqown
        2
    yeqown  
       Mar 16, 2021
    你看下 307 咋说的
    46fo
        3
    46fo  
    OP
       Mar 16, 2021
    @yeqown 30x 状态码是服务器返回的啊 这边改不了啊。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   970 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 32ms · UTC 20:41 · PVG 04:41 · LAX 13:41 · JFK 16:41
    ♥ Do have faith in what you're doing.