我有以下代码package mainimport ( "log" "net/http")func fooHandler(w http.ResponseWriter, r *http.Request) { // Here an if condition, if should redirect or not http.Redirect(w, r, "http://www.google.com", 301) // Do something.... // Call function if redirect was invoked}func main() { http.HandleFunc("/", fooHandler) err := http.ListenAndServe(":9090", nil) if err != nil { log.Fatal("ListenAndServe: ", err) }}如何检测重定向是否写在响应对象中?
3 回答
- 3 回答
- 0 关注
- 154 浏览
添加回答
举报
0/150
提交
取消