diff --git a/http/dataflow/dataflow.go b/http/dataflow/dataflow.go index 7e6cb92..117cceb 100644 --- a/http/dataflow/dataflow.go +++ b/http/dataflow/dataflow.go @@ -147,6 +147,8 @@ func (d *Dataflow) Query(key string, values ...string) contract.RequestDataflowI func (d *Dataflow) Json(jsonAny interface{}) contract.RequestDataflowInterface { // 设置 Header d.Header("content-type", "application/json") + d.Header("Accept", "*/*") + // 标准库Json编码 body reader var buf bytes.Buffer encoder := json.NewEncoder(&buf) @@ -248,6 +250,8 @@ func (d *Dataflow) Request() (response *http.Response, err error) { return nil, d.Err() } + d.Header("Accept", "*/*") + handle := d.middlewareHandle(func(request *http.Request) (response *http.Response, err error) { return d.client.DoRequest(request) })