自动更新

This commit is contained in:
徐俊杰 2022-03-16 16:47:46 +08:00
parent 7f48d739b8
commit 8fa91ec335
2 changed files with 3 additions and 2 deletions

View File

@ -131,7 +131,7 @@ r.Body().Set("beginDate", "2022-03-01").Set("endDate", "2022-03-03")
```
#### 字符串赋值
通过此方法直接赋值json数据
json格式不要使用此方法
```go
bodydata:=`{"devSn":"230000000008","type":"day"}`
r.Body().SetString(bodydata)

View File

@ -210,8 +210,9 @@ func (s *SimpleRequest) initBody() {
jsonData, err := json.Marshal(s.tempBody)
if err == nil {
s.body = bytes.NewReader(jsonData)
} else {
s.body = bytes.NewReader([]byte("{}"))
}
s.body = bytes.NewReader(jsonData)
case contentTypeData == xmlDataType || contentTypeData == textPlainType || contentTypeData == javaScriptType:
data, _ := s.tempBody[stringBodyType].(string)
s.body = strings.NewReader(data)