Skip to content

Commit

Permalink
fix: return HTTP 400 instead of 500 for bad query parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
alnr committed Jun 21, 2023
1 parent eac908c commit 58258eb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion x/http_secure_redirect.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func SecureRedirectTo(r *http.Request, defaultReturnTo *url.URL, opts ...SecureR

returnTo, err = url.Parse(rawReturnTo)
if err != nil {
return nil, errors.WithStack(herodot.ErrInternalServerError.WithWrap(err).WithReasonf("Unable to parse the return_to query parameter as an URL: %s", err))
return nil, errors.WithStack(herodot.ErrBadRequest.WithWrap(err).WithReasonf("Unable to parse the return_to query parameter as an URL: %s", err))
}

returnTo.Host = stringsx.Coalesce(returnTo.Host, o.defaultReturnTo.Host)
Expand Down

0 comments on commit 58258eb

Please sign in to comment.