Skip to content

Commit

Permalink
change how to get query parameter issue #510
Browse files Browse the repository at this point in the history
  • Loading branch information
emicklei committed Sep 30, 2022
1 parent 67c9f7e commit bb9d1d8
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions request.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ func NewRequest(httpRequest *http.Request) *Request {
// a "Unable to unmarshal content of type:" response is returned.
// Valid values are restful.MIME_JSON and restful.MIME_XML
// Example:
// restful.DefaultRequestContentType(restful.MIME_JSON)
//
// restful.DefaultRequestContentType(restful.MIME_JSON)
func DefaultRequestContentType(mime string) {
defaultRequestContentType = mime
}
Expand All @@ -48,7 +49,7 @@ func (r *Request) PathParameters() map[string]string {

// QueryParameter returns the (first) Query parameter value by its name
func (r *Request) QueryParameter(name string) string {
return r.Request.FormValue(name)
return r.Request.URL.Query().Get(name)
}

// QueryParameters returns the all the query parameters values by name
Expand Down

0 comments on commit bb9d1d8

Please sign in to comment.