自动更新
This commit is contained in:
parent
7f48d739b8
commit
8fa91ec335
@ -131,7 +131,7 @@ r.Body().Set("beginDate", "2022-03-01").Set("endDate", "2022-03-03")
|
|||||||
```
|
```
|
||||||
|
|
||||||
#### 字符串赋值
|
#### 字符串赋值
|
||||||
通过此方法直接赋值json数据
|
json格式不要使用此方法
|
||||||
```go
|
```go
|
||||||
bodydata:=`{"devSn":"230000000008","type":"day"}`
|
bodydata:=`{"devSn":"230000000008","type":"day"}`
|
||||||
r.Body().SetString(bodydata)
|
r.Body().SetString(bodydata)
|
||||||
|
@ -210,8 +210,9 @@ func (s *SimpleRequest) initBody() {
|
|||||||
jsonData, err := json.Marshal(s.tempBody)
|
jsonData, err := json.Marshal(s.tempBody)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
s.body = bytes.NewReader(jsonData)
|
s.body = bytes.NewReader(jsonData)
|
||||||
|
} else {
|
||||||
|
s.body = bytes.NewReader([]byte("{}"))
|
||||||
}
|
}
|
||||||
s.body = bytes.NewReader(jsonData)
|
|
||||||
case contentTypeData == xmlDataType || contentTypeData == textPlainType || contentTypeData == javaScriptType:
|
case contentTypeData == xmlDataType || contentTypeData == textPlainType || contentTypeData == javaScriptType:
|
||||||
data, _ := s.tempBody[stringBodyType].(string)
|
data, _ := s.tempBody[stringBodyType].(string)
|
||||||
s.body = strings.NewReader(data)
|
s.body = strings.NewReader(data)
|
||||||
|
Loading…
Reference in New Issue
Block a user