vendor: go.opentelemetry.io/otel v1.42.0, otel/contrib v1.67.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
+3
-1
@@ -28,7 +28,9 @@ func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshal
|
||||
}
|
||||
handleForwardResponseServerMetadata(w, mux, md)
|
||||
|
||||
w.Header().Set("Transfer-Encoding", "chunked")
|
||||
if !mux.disableChunkedEncoding {
|
||||
w.Header().Set("Transfer-Encoding", "chunked")
|
||||
}
|
||||
if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil {
|
||||
HTTPError(ctx, mux, marshaler, w, req, err)
|
||||
return
|
||||
|
||||
+11
@@ -73,6 +73,7 @@ type ServeMux struct {
|
||||
disablePathLengthFallback bool
|
||||
unescapingMode UnescapingMode
|
||||
writeContentLength bool
|
||||
disableChunkedEncoding bool
|
||||
}
|
||||
|
||||
// ServeMuxOption is an option that can be given to a ServeMux on construction.
|
||||
@@ -125,6 +126,16 @@ func WithMiddlewares(middlewares ...Middleware) ServeMuxOption {
|
||||
}
|
||||
}
|
||||
|
||||
// WithDisableChunkedEncoding disables the Transfer-Encoding: chunked header
|
||||
// for streaming responses. This is useful for streaming implementations that use
|
||||
// Content-Length, which is mutually exclusive with Transfer-Encoding:chunked.
|
||||
// Note that this option will not automatically add Content-Length headers, so it should be used with caution.
|
||||
func WithDisableChunkedEncoding() ServeMuxOption {
|
||||
return func(mux *ServeMux) {
|
||||
mux.disableChunkedEncoding = true
|
||||
}
|
||||
}
|
||||
|
||||
// SetQueryParameterParser sets the query parameter parser, used to populate message from query parameters.
|
||||
// Configuring this will mean the generated OpenAPI output is no longer correct, and it should be
|
||||
// done with careful consideration.
|
||||
|
||||
Reference in New Issue
Block a user