From 412eeb494b273cf10cd1046f899dc54417a3c9b2 Mon Sep 17 00:00:00 2001 From: Grzegorz Piwowarek Date: Tue, 14 May 2024 15:57:13 +0200 Subject: [PATCH] Our router is missing http header parameters (#104) Pass HTTP headers to the internal router --- quesma/quesma/mux/mux.go | 3 ++- quesma/quesma/quesma.go | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/quesma/quesma/mux/mux.go b/quesma/quesma/mux/mux.go index d585ac5da..29dc9f0cc 100644 --- a/quesma/quesma/mux/mux.go +++ b/quesma/quesma/mux/mux.go @@ -4,6 +4,7 @@ import ( "context" "github.com/ucarion/urlpath" "mitmproxy/quesma/logger" + "net/http" "strings" ) @@ -46,7 +47,7 @@ func (p *PathRouter) RegisterPathMatcher(pattern string, httpMethods []string, p } } -func (p *PathRouter) Execute(ctx context.Context, path, body, httpMethod string) (*Result, error) { +func (p *PathRouter) Execute(ctx context.Context, path, body, httpMethod string, headers http.Header) (*Result, error) { handler, meta, found := p.findHandler(path, httpMethod, body) if found { return handler(ctx, body, path, meta.Params) diff --git a/quesma/quesma/quesma.go b/quesma/quesma/quesma.go index ec217a710..73a5c7214 100644 --- a/quesma/quesma/quesma.go +++ b/quesma/quesma/quesma.go @@ -128,7 +128,7 @@ func (r *router) reroute(ctx context.Context, w http.ResponseWriter, req *http.R } quesmaResponse, err := recordRequestToClickhouse(req.URL.Path, r.quesmaManagementConsole, func() (*mux.Result, error) { - return router.Execute(ctx, req.URL.Path, string(reqBody), req.Method) + return router.Execute(ctx, req.URL.Path, string(reqBody), req.Method, req.Header) }) var elkRawResponse elasticResult var elkResponse *http.Response