Skip to content

Commit

Permalink
fix:% mask %%
Browse files Browse the repository at this point in the history
  • Loading branch information
luopengift committed Aug 20, 2024
1 parent aaa5533 commit 6aeff30
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stat.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"strings"
"time"
)

Expand Down Expand Up @@ -89,7 +90,7 @@ func responseLoad(resp *Response) *Stat {
if resp.Request != nil {
stat.RequestId = resp.Request.Header.Get(RequestId)
stat.Request.Method = resp.Request.Method
stat.Request.URL = resp.Request.URL.String()
stat.Request.URL = strings.ReplaceAll(resp.Request.URL.String(), "%", "%%")
if resp.Request.GetBody != nil {
body, err := resp.Request.GetBody()
if err != nil {
Expand Down Expand Up @@ -136,7 +137,7 @@ func serveLoad(w *ResponseWriter, r *http.Request, start time.Time, buf *bytes.B
for k, v := range r.Header {
stat.Request.Header[k] = v[0]
}
stat.Request.URL = r.URL.String()
stat.Request.URL = strings.ReplaceAll(r.URL.String(), "%", "%%")

if buf != nil {
m := make(map[string]any)
Expand Down

0 comments on commit 6aeff30

Please sign in to comment.