Skip to content

Commit 6aabde5

Browse files
committed
检测postJSON输入map
1 parent f960b73 commit 6aabde5

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

http/client/client.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,9 @@ func (c httpClient) PostJSON(url string, headers map[string]string, data interfa
9292
return errors.Trace(err)
9393
}
9494

95+
if headers == nil {
96+
headers = make(map[string]string)
97+
}
9598
headers["Content-type"] = "application/json"
9699

97100
if buf, err = c.do("POST", url, headers, buf); err != nil {

0 commit comments

Comments
 (0)