fix: correctly differ between grpc and grpc-web (#8292)

# Which Problems Are Solved

While #8285 also checked for `+proto` and `+json` grpc content types, it
accidentally matched all grpc-web requests to grpc.

# How the Problems Are Solved

- fixed the regex by checking for an exact match (added start `^` and
end `$` anchors)

# Additional Changes

None

# Additional Context

- relates to #8285
This commit is contained in:
Livio Spring 2024-07-12 11:54:02 +02:00 committed by GitHub
parent aa273ad000
commit d7c0ec282a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -180,7 +180,7 @@ func (a *API) RouteGRPC() {
Name("grpc")
http2Route.
Methods(http.MethodPost).
HeadersRegexp(http_util.ContentType, `application\/grpc(\+proto|\+json)?`).
HeadersRegexp(http_util.ContentType, `^application\/grpc(\+proto|\+json)?$`).
Handler(a.grpcServer)
a.routeGRPCWeb()