优化UserAgent的输入

This commit is contained in:
Yun
2024-01-24 23:27:20 +08:00
parent eeef2edd6f
commit e1eec65937
3 changed files with 17 additions and 4 deletions
+12 -1
View File
@@ -89,7 +89,18 @@ func SetParamsFormFile(fieldName, fileName string, fileBytes []byte) Param {
*/
func SetParamsHeaders(h map[string]interface{}) Param {
return func(param *ClientParams) {
param.Headers = h
for key, _ := range h {
param.Headers[key] = h[key]
}
}
}
/**
* 设置UserAgent
*/
func SetUserAgent(userAgent UserAgent) Param {
return func(param *ClientParams) {
param.Headers["User-Agent"] = string(userAgent)
}
}