1, 我有一个web应用
func main() {
http.HandleFunc("/", handler)
http.ListenAndServe(":8082", nil)
}
func handler(writer http.ResponseWriter, request *http.Request) {
fmt.Fprintf(writer, "Hellow world, %s %s", request.Method, request.URL.Path[1:])
}
2, 我有另一个web应用
`mux.HandleFunc("/index4", index4)`
func index4(writer http.ResponseWriter, request *http.Request) {
fmt.Println("Method4:", request.Method, request.URL)
http.Redirect(writer, request, "http://127.0.0.1:8082", http.StatusFound)
}
当我 用post请求第二个应用http://127.0.0.1:8081/index4时,第一个应该收到的居然是GET请求,为什么呢
有疑问加站长微信联系(非本文作者)