This commit is contained in:
Shreyas Goenka 2025-02-03 12:16:49 +01:00
parent 4f979007af
commit a8b366ee79
No known key found for this signature in database
GPG Key ID: 92A07DF49CCB0622
1 changed files with 0 additions and 23 deletions

View File

@ -28,29 +28,6 @@ type Request struct {
Body json.RawMessage `json:"body"`
}
// Returns a JSON string representation of the request, with the specified fields masked.
func (r Request) JsonString(maskFields []string) (string, error) {
body := map[string]any{}
err := json.Unmarshal([]byte(r.Body), &body)
if err != nil {
return "", err
}
for _, field := range maskFields {
body[field] = "****"
}
newBody, err := json.Marshal(body)
if err != nil {
return "", err
}
r.Body = newBody
b, err := json.Marshal(r)
return string(b), err
}
func New(t testutil.TestingT) *Server {
mux := http.NewServeMux()
server := httptest.NewServer(mux)