mirror of
https://github.com/kataras/iris.git
synced 2025-12-20 03:17:04 +00:00
add a full gRPC example as previously requested at: https://github.com/kataras/iris/issues/1449
Former-commit-id: 0cb5121e7d44644f7f0eb34597ff34274157fe95
This commit is contained in:
@@ -20,11 +20,11 @@ import (
|
||||
// app.WrapRouter(grpcWrapper.New(grpcServer))
|
||||
func New(grpcServer http.Handler) router.WrapperFunc {
|
||||
return func(w http.ResponseWriter, r *http.Request, mux http.HandlerFunc) {
|
||||
if r.ProtoMajor == 2 && strings.HasPrefix(
|
||||
r.Header.Get("Content-Type"), "application/grpc") {
|
||||
if r.ProtoMajor == 2 && strings.HasPrefix(r.Header.Get("Content-Type"), "application/grpc") {
|
||||
grpcServer.ServeHTTP(w, r)
|
||||
} else {
|
||||
mux.ServeHTTP(w, r)
|
||||
return
|
||||
}
|
||||
|
||||
mux.ServeHTTP(w, r)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user