1
0
mirror of https://github.com/taigrr/wasm-experiments synced 2025-01-18 04:03:21 -08:00

Use custom for of grpc-go and unify client and server

This commit is contained in:
Johan Brandhorst
2018-06-25 15:48:55 +01:00
parent 3d89b1de82
commit c7ec9fde8c
71 changed files with 2734 additions and 4250 deletions

View File

@@ -90,6 +90,7 @@ func (w *grpcWebResponse) copyTrailersAndHeadersToWrapped() {
}
}
w.writeCorsExposedHeaders()
hackIntogRPCWebContentType(wrappedHeader)
w.wrapped.WriteHeader(http.StatusOK)
w.wrapped.(http.Flusher).Flush()
}
@@ -134,5 +135,11 @@ func (w *grpcWebResponse) extractTrailerHeaders() http.Header {
trailerHeaders.Add(k, v)
}
}
hackIntogRPCWebContentType(trailerHeaders)
return trailerHeaders
}
func hackIntogRPCWebContentType(in http.Header) {
contentType := in.Get("content-type")
in.Set("content-type", strings.Replace(contentType, "application/grpc", "application/grpc-web", 1))
}