Skip to content

Commit

Permalink
Our router is missing http header parameters (#104)
Browse files Browse the repository at this point in the history
Pass HTTP headers to the internal router
  • Loading branch information
pivovarit authored May 14, 2024
1 parent 4886afc commit 412eeb4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion quesma/quesma/mux/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"github.com/ucarion/urlpath"
"mitmproxy/quesma/logger"
"net/http"
"strings"
)

Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion quesma/quesma/quesma.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 412eeb4

Please sign in to comment.