Skip to content

Commit

Permalink
issue go-chi#24 make content type error as predefined variable
Browse files Browse the repository at this point in the history
  • Loading branch information
rskumar committed Aug 27, 2019
1 parent 3215478 commit 9c946aa
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ import (
"net/http"
)

var (
ErrUnsupportedContentType = errors.New("render: unsupported content-type")
)

// Decode is a package-level variable set to our default Decoder. We do this
// because it allows you to set render.Decode to another function with the
// same function signature, while also utilizing the render.Decoder() function
Expand All @@ -27,7 +31,8 @@ func DefaultDecoder(r *http.Request, v interface{}) error {
err = DecodeXML(r.Body, v)
// case ContentTypeForm: // TODO
default:
err = errors.New("render: unable to automatically decode the request content type")
//err = errors.New("render: unable to automatically decode the request content type")
err = ErrUnsupportedContentType
}

return err
Expand Down

0 comments on commit 9c946aa

Please sign in to comment.