Skip to content

Commit

Permalink
don't use Request.GetBody (TykTechnologies#2434)
Browse files Browse the repository at this point in the history
Decode json directly from r.Body because r.GetBody is nil

Fixes TykTechnologies#2375
Fixes TykTechnologies#2398
  • Loading branch information
gernest authored and buger committed Aug 1, 2019
1 parent f87150f commit e747861
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions gateway/oauth_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,7 @@ func (o *OAuthManager) HandleAuthorisation(r *http.Request, complete bool, sessi
func JSONToFormValues(r *http.Request) error {
if r.Header.Get("Content-Type") == "application/json" {
var o map[string]string
// we don't want to mess with the original body so we are going to work with a
// copy.
body, err := r.GetBody()
if err != nil {
return err
}
err = json.NewDecoder(body).Decode(&o)
err := json.NewDecoder(r.Body).Decode(&o)
if err != nil {
return err
}
Expand Down

0 comments on commit e747861

Please sign in to comment.