You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
代码如上。此处运行时,在不修改任何数据的情况下。所有流程能走通。并且能获取到对应的request.body和response.body和对应的header。
但是一旦我设置了request.body。服务器返回的值则直接是错误。但是此处我打印过正常请求的格式和自行生成的格式,是一致的。所以想请问下怎么对request.body的修改
Code as above. Run here without modifying any data. All processes can go through. Body and Response. body and the corresponding header can be obtained.
But once I set request.body. The value returned by the server is an error. But here I printed the format of the normal request and the generated format is the same. So I would like to ask how to modify request.body
The text was updated successfully, but these errors were encountered:
router.MustAdd("/*", func(ctx *rod.Hijack) {
//开始设置标头
r := ctx.Request.SetContext(browser.GetContext())
rest := ctx.Request.Headers()
//设置body
STime := []SearchTime{{Start: "20210923", End: "20210924"}}
SearchFiltertr, err := json.Marshal(SearchFilter{D: STime})
if err != nil {
fmt.Println(err)
}
body := SearchCondition{Count: true, Filter: string(SearchFiltertr)}
fmt.Println("json")
bodystr, err := json.Marshal(body)
if err != nil {
fmt.Println(err)
}
fmt.Println(string(bodystr))
fmt.Println(r.Body())
代码如上。此处运行时,在不修改任何数据的情况下。所有流程能走通。并且能获取到对应的request.body和response.body和对应的header。
但是一旦我设置了request.body。服务器返回的值则直接是错误。但是此处我打印过正常请求的格式和自行生成的格式,是一致的。所以想请问下怎么对request.body的修改
Code as above. Run here without modifying any data. All processes can go through. Body and Response. body and the corresponding header can be obtained.
But once I set request.body. The value returned by the server is an error. But here I printed the format of the normal request and the generated format is the same. So I would like to ask how to modify request.body
The text was updated successfully, but these errors were encountered: