(req *http.Request)
| 1813 | } |
| 1814 | |
| 1815 | func (g *graphQLRecorder) RoundTrip(req *http.Request) (*http.Response, error) { |
| 1816 | if req.Body != nil && strings.HasSuffix(req.URL.Path, "/graphql") { |
| 1817 | body, err := io.ReadAll(req.Body) |
| 1818 | if err != nil { |
| 1819 | return nil, err |
| 1820 | } |
| 1821 | req.Body = io.NopCloser(bytes.NewReader(body)) |
| 1822 | g.mu.Lock() |
| 1823 | g.queries = append(g.queries, string(body)) |
| 1824 | g.mu.Unlock() |
| 1825 | } |
| 1826 | return g.inner.RoundTrip(req) |
| 1827 | } |
| 1828 | |
| 1829 | // recorded returns every query seen so far, joined for substring matching. |
| 1830 | func (g *graphQLRecorder) recorded() string { |
nothing calls this directly
no outgoing calls
no test coverage detected