go.mod: bump client-go and api machinerie
I had to run `make generate`. Some API functions got additional parameters `Options` and `Context`. I used empty options and `context.TODO()` for now. Signed-off-by: leonnicolas <leonloechner@gmx.de>
This commit is contained in:
12
vendor/github.com/emicklei/go-restful/CHANGES.md
generated
vendored
12
vendor/github.com/emicklei/go-restful/CHANGES.md
generated
vendored
@@ -1,6 +1,18 @@
|
||||
## Change history of go-restful
|
||||
|
||||
|
||||
v2.9.5
|
||||
- fix panic in Response.WriteError if err == nil
|
||||
|
||||
v2.9.4
|
||||
|
||||
- fix issue #400 , parsing mime type quality
|
||||
- Route Builder added option for contentEncodingEnabled (#398)
|
||||
|
||||
v2.9.3
|
||||
|
||||
- Avoid return of 415 Unsupported Media Type when request body is empty (#396)
|
||||
|
||||
v2.9.2
|
||||
|
||||
- Reduce allocations in per-request methods to improve performance (#395)
|
||||
|
11
vendor/github.com/emicklei/go-restful/mime.go
generated
vendored
11
vendor/github.com/emicklei/go-restful/mime.go
generated
vendored
@@ -22,7 +22,10 @@ func insertMime(l []mime, e mime) []mime {
|
||||
return append(l, e)
|
||||
}
|
||||
|
||||
const qFactorWeightingKey = "q"
|
||||
|
||||
// sortedMimes returns a list of mime sorted (desc) by its specified quality.
|
||||
// e.g. text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3
|
||||
func sortedMimes(accept string) (sorted []mime) {
|
||||
for _, each := range strings.Split(accept, ",") {
|
||||
typeAndQuality := strings.Split(strings.Trim(each, " "), ";")
|
||||
@@ -30,14 +33,16 @@ func sortedMimes(accept string) (sorted []mime) {
|
||||
sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0})
|
||||
} else {
|
||||
// take factor
|
||||
parts := strings.Split(typeAndQuality[1], "=")
|
||||
if len(parts) == 2 {
|
||||
f, err := strconv.ParseFloat(parts[1], 64)
|
||||
qAndWeight := strings.Split(typeAndQuality[1], "=")
|
||||
if len(qAndWeight) == 2 && strings.Trim(qAndWeight[0], " ") == qFactorWeightingKey {
|
||||
f, err := strconv.ParseFloat(qAndWeight[1], 64)
|
||||
if err != nil {
|
||||
traceLogger.Printf("unable to parse quality in %s, %v", each, err)
|
||||
} else {
|
||||
sorted = insertMime(sorted, mime{typeAndQuality[0], f})
|
||||
}
|
||||
} else {
|
||||
sorted = insertMime(sorted, mime{typeAndQuality[0], 1.0})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
9
vendor/github.com/emicklei/go-restful/response.go
generated
vendored
9
vendor/github.com/emicklei/go-restful/response.go
generated
vendored
@@ -174,10 +174,15 @@ func (r *Response) WriteHeaderAndJson(status int, value interface{}, contentType
|
||||
return writeJSON(r, status, contentType, value)
|
||||
}
|
||||
|
||||
// WriteError write the http status and the error string on the response.
|
||||
// WriteError write the http status and the error string on the response. err can be nil.
|
||||
func (r *Response) WriteError(httpStatus int, err error) error {
|
||||
r.err = err
|
||||
return r.WriteErrorString(httpStatus, err.Error())
|
||||
if err == nil {
|
||||
r.WriteErrorString(httpStatus, "")
|
||||
} else {
|
||||
r.WriteErrorString(httpStatus, err.Error())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
// WriteServiceError is a convenience method for a responding with a status and a ServiceError
|
||||
|
47
vendor/github.com/emicklei/go-restful/route_builder.go
generated
vendored
47
vendor/github.com/emicklei/go-restful/route_builder.go
generated
vendored
@@ -38,6 +38,7 @@ type RouteBuilder struct {
|
||||
defaultResponse *ResponseError
|
||||
metadata map[string]interface{}
|
||||
deprecated bool
|
||||
contentEncodingEnabled *bool
|
||||
}
|
||||
|
||||
// Do evaluates each argument with the RouteBuilder itself.
|
||||
@@ -233,6 +234,12 @@ func (b *RouteBuilder) If(condition RouteSelectionConditionFunction) *RouteBuild
|
||||
return b
|
||||
}
|
||||
|
||||
// ContentEncodingEnabled allows you to override the Containers value for auto-compressing this route response.
|
||||
func (b *RouteBuilder) ContentEncodingEnabled(enabled bool) *RouteBuilder {
|
||||
b.contentEncodingEnabled = &enabled
|
||||
return b
|
||||
}
|
||||
|
||||
// If no specific Route path then set to rootPath
|
||||
// If no specific Produces then set to rootProduces
|
||||
// If no specific Consumes then set to rootConsumes
|
||||
@@ -269,25 +276,27 @@ func (b *RouteBuilder) Build() Route {
|
||||
operationName = nameOfFunction(b.function)
|
||||
}
|
||||
route := Route{
|
||||
Method: b.httpMethod,
|
||||
Path: concatPath(b.rootPath, b.currentPath),
|
||||
Produces: b.produces,
|
||||
Consumes: b.consumes,
|
||||
Function: b.function,
|
||||
Filters: b.filters,
|
||||
If: b.conditions,
|
||||
relativePath: b.currentPath,
|
||||
pathExpr: pathExpr,
|
||||
Doc: b.doc,
|
||||
Notes: b.notes,
|
||||
Operation: operationName,
|
||||
ParameterDocs: b.parameters,
|
||||
ResponseErrors: b.errorMap,
|
||||
DefaultResponse: b.defaultResponse,
|
||||
ReadSample: b.readSample,
|
||||
WriteSample: b.writeSample,
|
||||
Metadata: b.metadata,
|
||||
Deprecated: b.deprecated}
|
||||
Method: b.httpMethod,
|
||||
Path: concatPath(b.rootPath, b.currentPath),
|
||||
Produces: b.produces,
|
||||
Consumes: b.consumes,
|
||||
Function: b.function,
|
||||
Filters: b.filters,
|
||||
If: b.conditions,
|
||||
relativePath: b.currentPath,
|
||||
pathExpr: pathExpr,
|
||||
Doc: b.doc,
|
||||
Notes: b.notes,
|
||||
Operation: operationName,
|
||||
ParameterDocs: b.parameters,
|
||||
ResponseErrors: b.errorMap,
|
||||
DefaultResponse: b.defaultResponse,
|
||||
ReadSample: b.readSample,
|
||||
WriteSample: b.writeSample,
|
||||
Metadata: b.metadata,
|
||||
Deprecated: b.deprecated,
|
||||
contentEncodingEnabled: b.contentEncodingEnabled,
|
||||
}
|
||||
route.postBuild()
|
||||
return route
|
||||
}
|
||||
|
Reference in New Issue
Block a user