bump(github.com/emicklei/go-restful):09691a3b6378b740595c1002f40c34dd5f218a22

This commit is contained in:
Clayton Coleman
2016-12-12 11:09:42 -05:00
parent 492f8d412f
commit c5f3784198
11 changed files with 95 additions and 41 deletions

View File

@@ -13,7 +13,7 @@ import (
var defaultRequestContentType string
var doCacheReadEntityBytes = true
var doCacheReadEntityBytes = false
// Request is a wrapper for a http Request that provides convenience methods
type Request struct {
@@ -107,10 +107,15 @@ func (r *Request) ReadEntity(entityPointer interface{}) (err error) {
r.Request.Body = zlibReader
}
// lookup the EntityReader
// lookup the EntityReader, use defaultRequestContentType if needed and provided
entityReader, ok := entityAccessRegistry.accessorAt(contentType)
if !ok {
return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType)
if len(defaultRequestContentType) != 0 {
entityReader, ok = entityAccessRegistry.accessorAt(defaultRequestContentType)
}
if !ok {
return NewError(http.StatusBadRequest, "Unable to unmarshal content of type:"+contentType)
}
}
return entityReader.Read(r, entityPointer)
}