From 9497f521ded10e9e6e19728e95115296c269f3fb Mon Sep 17 00:00:00 2001 From: Jye Cusch Date: Mon, 28 Feb 2022 11:36:28 +1100 Subject: [PATCH] fix: use original path value for HttpRequests avoid splitting on encoded forward slashes and preserve encoded characters Fixes: https://github.com/nitrictech/nitric/pull/224 --- pkg/run/gateway.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/run/gateway.go b/pkg/run/gateway.go index c07d3ae55..4b123ebf3 100644 --- a/pkg/run/gateway.go +++ b/pkg/run/gateway.go @@ -53,7 +53,7 @@ func apiWorkerFilter(apiName string) func(w worker.Worker) bool { func (s *BaseHttpGateway) api(ctx *fasthttp.RequestCtx) { apiName := ctx.UserValue("name").(string) // Rewrite the URL of the request to remove the /api/{name} subroute - pathParts := nitric_utils.SplitPath(string(ctx.Path())) + pathParts := nitric_utils.SplitPath(string(ctx.URI().PathOriginal())) // remove first two path parts newPathParts := pathParts[2:]