Skip to content

Commit

Permalink
FixUserAgentError
Browse files Browse the repository at this point in the history
  • Loading branch information
wenzuochao committed Sep 7, 2020
1 parent ecd1812 commit 45df60e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tea/tea.go
Original file line number Diff line number Diff line change
Expand Up @@ -317,6 +317,10 @@ func DoRequest(request *Request, requestRuntime map[string]interface{}) (respons
continue
} else if key == "host" {
httpRequest.Header["Host"] = []string{*value}
delete(httpRequest.Header, "host")
} else if key == "user-agent" {
httpRequest.Header["User-Agent"] = []string{*value}
delete(httpRequest.Header, "user-agent")
} else {
httpRequest.Header[key] = []string{*value}
}
Expand Down
1 change: 1 addition & 0 deletions tea/tea_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ func Test_DoRequest(t *testing.T) {
utils.AssertEqual(t, `Internal error`, err.Error())

request.Headers["host"] = String("tea-cn-hangzhou.aliyuncs.com:80")
request.Headers["user-agent"] = String("test")
resp, err = DoRequest(request, runtimeObj)
utils.AssertNil(t, resp)
utils.AssertEqual(t, `Internal error`, err.Error())
Expand Down

0 comments on commit 45df60e

Please sign in to comment.