我想http.Client為所有請求添加其他標題。type MyClient struct { http.Client}func (c *MyClient) Do(req *http.Request) (*http.Response, error) { req.Header.Add("User-Agent", "go") return c.Client.Do(req)}func Do如果我func PostForm使用的話永遠不會打電話Do。如果沒有辦法模仿OOP,如何最輕松地做到這一點?
- 1 回答
- 0 關(guān)注
- 240 瀏覽
添加回答
舉報
0/150
提交
取消