Skip to content

Commit ef03374

Browse files
authored
feat: pass in response body (#1203)
1 parent 0a37383 commit ef03374

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

v2/pkg/engine/resolve/loader.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,16 @@ type ResponseInfo struct {
5555
Request *http.Request
5656
// ResponseHeaders contains a clone of the headers of the response from the subgraph.
5757
ResponseHeaders http.Header
58+
// ResponseBody contains the response body of the subgraph, it is of type string so that it cannot be manipulated.
59+
ResponseBody string
5860
}
5961

6062
func newResponseInfo(res *result, subgraphError error) *ResponseInfo {
61-
responseInfo := &ResponseInfo{StatusCode: res.statusCode, Err: goerrors.Join(res.err, subgraphError)}
63+
responseInfo := &ResponseInfo{
64+
StatusCode: res.statusCode,
65+
Err: goerrors.Join(res.err, subgraphError),
66+
ResponseBody: res.out.String(),
67+
}
6268
if res.httpResponseContext != nil {
6369
// We're using the response.Request here, because the body will be nil (since the response was read) and won't
6470
// cause a memory leak.

0 commit comments

Comments
 (0)