Skip to content

Commit 0cc6a6c

Browse files
authored
fix(websockets): fix websockets non root resources replace (#1096)
#1095
1 parent 5bb1a45 commit 0cc6a6c

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

go/grpcweb/wrapper.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (w *WrappedGrpcServer) IsGrpcWebSocketRequest(req *http.Request) bool {
144144
func (w *WrappedGrpcServer) HandleGrpcWebRequest(resp http.ResponseWriter, req *http.Request) {
145145
intReq, isTextFormat := hackIntoNormalGrpcRequest(req)
146146
intResp := newGrpcWebResponse(resp, isTextFormat)
147-
req.URL.Path = w.endpointFunc(req)
147+
intReq.URL.Path = w.endpointFunc(intReq)
148148
w.handler.ServeHTTP(intResp, intReq)
149149
intResp.finishRequest(req)
150150
}
@@ -206,12 +206,13 @@ func (w *WrappedGrpcServer) HandleGrpcWebsocketRequest(resp http.ResponseWriter,
206206
req.Body = wrappedReader
207207
req.Method = http.MethodPost
208208
req.Header = headers
209+
req.URL.Path = w.endpointFunc(req)
209210

210211
interceptedRequest, isTextFormat := hackIntoNormalGrpcRequest(req.WithContext(ctx))
211212
if isTextFormat {
212213
grpclog.Errorf("web socket text format requests not yet supported")
213214
}
214-
req.URL.Path = w.endpointFunc(req)
215+
215216
w.handler.ServeHTTP(respWriter, interceptedRequest)
216217
}
217218

0 commit comments

Comments
 (0)