Skip to content

Commit

Permalink
use r.FormData inatead of creating new variable
Browse files Browse the repository at this point in the history
  • Loading branch information
SVilgelm committed Oct 2, 2023
1 parent 3a60dae commit 3408a15
Showing 1 changed file with 3 additions and 8 deletions.
11 changes: 3 additions & 8 deletions middleware.go
Original file line number Diff line number Diff line change
Expand Up @@ -405,20 +405,15 @@ func handleMultipart(c *Client, r *Request) error {
}

func handleFormData(c *Client, r *Request) {
formData := url.Values{}
for k, v := range r.FormData {
formData[k] = v[:]
}

for k, v := range c.FormData {
if _, ok := formData[k]; ok {
if _, ok := r.FormData[k]; ok {
continue
}
formData[k] = v[:]
r.FormData[k] = v[:]
}

r.bodyBuf = acquireBuffer()
r.bodyBuf.WriteString(formData.Encode())
r.bodyBuf.WriteString(r.FormData.Encode())
r.Header.Set(hdrContentTypeKey, formContentType)
r.isFormData = true
}
Expand Down

0 comments on commit 3408a15

Please sign in to comment.