Comments (2)
It's currently not an option that is supported. As a workaround for now you may inspect the content type to classify the request as a grpc/grpcWeb request and return a 415 Unsupported Media Type status otherwise. Here is an example in HTTP middleware:
func grpcOnlyMiddleware(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if !strings.HasPrefix(r.Header.Get("Content-Type"), "application/grpc") {
w.WriteHeader(http.StatusUnsupportedMediaType)
return
}
next.ServeHTTP(w, r)
})
}
from connect-go.
Perfect, works like a charm, thank you.
from connect-go.
Related Issues (20)
- How to obtain underlying http Request? HOT 3
- bazel cannot find some connect types HOT 2
- How to add deadline to the service call context HOT 5
- Improve support for observability frameworks HOT 4
- Doesn't work with mocked HTTP client HOT 2
- How to detect if client closed the stream for server streaming method? HOT 2
- Transport-level retry support for RPCs with streaming request
- Emitting empty fields in JSON response HOT 2
- Missing Go package metadata on connectrpc.com HOT 9
- ErrorWriter.IsSupported is overly strict
- Exporting `memhttp` / `memhttptest` HOT 2
- Include prebuilt executables in releases HOT 3
- ErrorWriter does not respect connect.WithRequireConnectProtocolHeader option
- OpenApi spec generation? HOT 1
- Is there a benchmark compare with original gprc? HOT 2
- Newz
- connect.CodeOf(nil) returns connect.CodeUnknown which is different to gRPC HOT 2
- Cannot test correct handling of `serverStream.Send` error HOT 6
- Why not return a Trailers-only response other than gRPC-Web? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from connect-go.