Skip to content

Commit

Permalink
feat: set content-type only when it doesn't exist on user custom head…
Browse files Browse the repository at this point in the history
…ers (#379)

* feat: set content-type only when it doesn't exist on user custom headers

* feat: set content-type when it doesn't exist
  • Loading branch information
simpleapples committed Dec 13, 2023
1 parent 511f37c commit 2521c68
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion dataflow/req.go
Expand Up @@ -123,6 +123,10 @@ func (r *Req) addDefDebug() {
}

func (r *Req) addContextType(req *http.Request) {
if req.Header.Get("Content-Type") != "" {
return
}

if r.wwwForm != nil {
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
}
Expand Down Expand Up @@ -314,7 +318,7 @@ func (r *Req) Request() (req *http.Request, err error) {
req.AddCookie(c)
}

if r.form != nil {
if r.form != nil && req.Header.Get("Content-Type") == "" {
req.Header.Add("Content-Type", f.FormDataContentType())
}

Expand Down

0 comments on commit 2521c68

Please sign in to comment.