Skip to content

Commit

Permalink
Merge pull request #75 from ArtisanCloud/feature/httpRequest
Browse files Browse the repository at this point in the history
fix(http): request with default header
  • Loading branch information
Matrix-X authored Feb 7, 2023
2 parents 7788735 + 6e2012e commit d2a9911
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions http/dataflow/dataflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
})
Expand Down

0 comments on commit d2a9911

Please sign in to comment.