Skip to content

Commit eaf7ab3

Browse files
committed
feat: exposed raw response string in GraphQLResponse
1 parent 5708496 commit eaf7ab3

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

graphql-webclient/src/main/java/graphql/kickstart/spring/webclient/boot/GraphQLResponse.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,15 @@ public class GraphQLResponse {
1515

1616
public static final String ERRORS_FIELD = "errors";
1717

18+
@Getter
19+
private final String rawResponse;
1820
private final JsonNode data;
1921
@Getter
2022
private final List<GraphQLError> errors;
2123
private final ObjectMapper objectMapper;
2224

2325
GraphQLResponse(String rawResponse, ObjectMapper objectMapper) {
26+
this.rawResponse = rawResponse;
2427
this.objectMapper = objectMapper;
2528

2629
JsonNode tree = readTree(rawResponse);

graphql-webclient/src/test/java/graphql/kickstart/spring/webclient/boot/GraphQLResponseTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,10 @@ void getList_dataFieldExists_returnsList() {
9595
assertEquals("value", values.get(0));
9696
}
9797

98+
@Test
99+
void getRawResponse() {
100+
GraphQLResponse response = constructResponse("{ \"data\": null }");
101+
assertEquals("{ \"data\": null }", response.getRawResponse());
102+
}
103+
98104
}

0 commit comments

Comments
 (0)