我正在嘗試查看location響應標頭是否包含字符串queue這是結構:if resp.StatusCode >= 200 && resp.StatusCode <= 399 { client.CheckRedirect = func(req *http.Request, via []*http.Request) error { return errors.New("Redirect") } if location_headers_here_contains "queue" { fmt.Println("queue") } else { fmt.Println("Nope!") } }這樣做的正確方法是什么?
1 回答

ABOUTYOU
TA貢獻1812條經驗 獲得超5個贊
利用
if strings.Contains(resp.Header.Get("Location"),"queue") {
fmt.Println("queue")
} else {
fmt.Println("Nope!")
}
- 1 回答
- 0 關注
- 180 瀏覽
添加回答
舉報
0/150
提交
取消