requestPayloads preserves field boundaries when comparing request data.
(requests []loggedRequest, name string)
| 443 | |
| 444 | // requestPayloads preserves field boundaries when comparing request data. |
| 445 | func requestPayloads(requests []loggedRequest, name string) []requestPayload { |
| 446 | var payloads []requestPayload |
| 447 | for _, e := range requests { |
| 448 | if displayName(e) != name { |
| 449 | continue |
| 450 | } |
| 451 | p := requestPayload{rawQuery: e.RawQuery} |
| 452 | if e.GraphQL != nil { |
| 453 | p.graphQL = true |
| 454 | p.query = e.GraphQL.Query |
| 455 | p.variables = compactJSON(e.GraphQL.Variables) |
| 456 | } else if e.RawBody != nil { |
| 457 | p.raw = true |
| 458 | p.rawBody = string(*e.RawBody) |
| 459 | } else { |
| 460 | p.body = compactJSON([]byte(e.Body)) |
| 461 | } |
| 462 | payloads = append(payloads, p) |
| 463 | } |
| 464 | return payloads |
| 465 | } |
| 466 | |
| 467 | func formatPayloads(payloads []requestPayload) string { |
| 468 | var formatted []string |
no test coverage detected