@@ -31,6 +31,7 @@ type Handler struct {
3131 protocolHandlers map [string ][]protocolHandler // Method to protocol handlers
3232 allowMethod string // Allow header
3333 acceptPost string // Accept-Post header
34+ experimental ExperimentalFeatures
3435}
3536
3637// NewUnaryHandler constructs a [Handler] for a request-response procedure.
@@ -82,6 +83,8 @@ func NewUnaryHandler[Req, Res any](
8283 protocolHandlers : mappedMethodHandlers (protocolHandlers ),
8384 allowMethod : sortedAllowMethodValue (protocolHandlers ),
8485 acceptPost : sortedAcceptPostValue (protocolHandlers ),
86+
87+ experimental : config .Experimental ,
8588 }
8689}
8790
@@ -165,7 +168,7 @@ func (h *Handler) ServeHTTP(responseWriter http.ResponseWriter, request *http.Re
165168 if isBidi && request .ProtoMajor < 2 {
166169 // Check if we allow bidi stream over HTTP/1.1, enable full-duplex support
167170 // and if fail, we fallback to the default behaviour.
168- if ! DisallowBidiStreamingHttp11 {
171+ if h . experimental . AllowBidiStreamOverHTTP11 {
169172 responseController := http .NewResponseController (responseWriter )
170173 if err := responseController .EnableFullDuplex (); err == nil {
171174 goto Pass
@@ -262,6 +265,8 @@ type handlerConfig struct {
262265 ReadMaxBytes int
263266 SendMaxBytes int
264267 StreamType StreamType
268+
269+ Experimental ExperimentalFeatures
265270}
266271
267272func newHandlerConfig (procedure string , streamType StreamType , options []HandlerOption ) * handlerConfig {
@@ -314,6 +319,7 @@ func (c *handlerConfig) newProtocolHandlers() []protocolHandler {
314319 SendMaxBytes : c .SendMaxBytes ,
315320 RequireConnectProtocolHeader : c .RequireConnectProtocolHeader ,
316321 IdempotencyLevel : c .IdempotencyLevel ,
322+ Experimental : c .Experimental ,
317323 }))
318324 }
319325 return handlers
@@ -333,5 +339,7 @@ func newStreamHandler(
333339 protocolHandlers : mappedMethodHandlers (protocolHandlers ),
334340 allowMethod : sortedAllowMethodValue (protocolHandlers ),
335341 acceptPost : sortedAcceptPostValue (protocolHandlers ),
342+
343+ experimental : config .Experimental ,
336344 }
337345}
0 commit comments