File tree 1 file changed +11
-8
lines changed
1 file changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -539,8 +539,13 @@ func (r *routes) matcher(w http.ResponseWriter, req *http.Request) {
539
539
Value : labelValuesToRegexpString (MustLabelValues (req .Context ())),
540
540
}
541
541
542
- var q url.Values
543
- if req .Method == http .MethodPost && req .Header .Get ("Content-Type" ) == "application/x-www-form-urlencoded" {
542
+ q := req .URL .Query ()
543
+ if err := injectMatcher (q , matcher ); err != nil {
544
+ return
545
+ }
546
+
547
+ req .URL .RawQuery = q .Encode ()
548
+ if req .Method == http .MethodPost {
544
549
if err := req .ParseForm (); err != nil {
545
550
return
546
551
}
@@ -555,18 +560,16 @@ func (r *routes) matcher(w http.ResponseWriter, req *http.Request) {
555
560
newBody := q .Encode ()
556
561
req .Body = io .NopCloser (strings .NewReader (newBody ))
557
562
req .ContentLength = int64 (len (newBody ))
558
- } else {
559
- q = req .URL .Query ()
560
- if err := injectMatcher (q , matcher ); err != nil {
561
- return
562
- }
563
563
}
564
564
565
- req .URL .RawQuery = q .Encode ()
566
565
r .handler .ServeHTTP (w , req )
567
566
}
568
567
569
568
func injectMatcher (q url.Values , matcher * labels.Matcher ) error {
569
+ if len (q ) == 0 {
570
+ return nil
571
+ }
572
+
570
573
matchers := q [matchersParam ]
571
574
if len (matchers ) == 0 {
572
575
q .Set (matchersParam , matchersToString (matcher ))
You can’t perform that action at this time.
0 commit comments