Skip to content

Commit f87d8c5

Browse files
committed
Remove requestBody method
It's not clear yet that we need to accept the full serialized body vs query, operation, and variables.
1 parent 983ca5d commit f87d8c5

File tree

3 files changed

+0
-52
lines changed

3 files changed

+0
-52
lines changed

spring-graphql-test/src/main/java/org/springframework/graphql/test/query/DefaultGraphQLTester.java

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -98,30 +98,6 @@ public QuerySpec query(String query) {
9898
return new DefaultQuerySpec(query);
9999
}
100100

101-
@Override
102-
public ExecuteSpec requestBody(String jsonBody) {
103-
return new ExecuteSpec() {
104-
105-
@Override
106-
public ResponseSpec execute() {
107-
RequestInput input = toRequestInput(jsonBody);
108-
return DefaultGraphQLTester.this.requestStrategy.execute(input);
109-
}
110-
111-
@Override
112-
public SubscriptionSpec executeSubscription() {
113-
RequestInput input = toRequestInput(jsonBody);
114-
return DefaultGraphQLTester.this.requestStrategy.executeSubscription(input);
115-
}
116-
117-
private RequestInput toRequestInput(String jsonBody) {
118-
DocumentContext context = JsonPath.parse(jsonBody, DefaultGraphQLTester.this.jsonPathConfig);
119-
Map<String, Object> map = context.read("$");
120-
return new RequestInput(map);
121-
}
122-
};
123-
}
124-
125101

126102
/**
127103
* Encapsulate how a GraphQL request is performed.

spring-graphql-test/src/main/java/org/springframework/graphql/test/query/GraphQLTester.java

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,15 +99,6 @@ public interface GraphQLTester {
9999
*/
100100
QuerySpec query(String query);
101101

102-
/**
103-
* Prepare to perform a GraphQL request with the given serialized HTTP request body.
104-
* @param jsonBody the full request body serialized to JSON
105-
* @return spec for response assertions
106-
* @throws AssertionError if the response status is not 200 (OK)
107-
* @see <a href="https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md">GraphQL over HTTP</a>
108-
*/
109-
ExecuteSpec requestBody(String jsonBody);
110-
111102

112103
/**
113104
* Create a {@code GraphQLTester} that performs GraphQL requests as an HTTP

spring-graphql-test/src/test/java/org/springframework/graphql/test/query/GraphQLTesterTests.java

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
import reactor.core.publisher.Mono;
4141

4242
import org.springframework.core.ParameterizedTypeReference;
43-
import org.springframework.graphql.RequestInput;
4443
import org.springframework.graphql.WebGraphQLService;
4544
import org.springframework.graphql.WebInput;
4645
import org.springframework.graphql.WebOutput;
@@ -214,24 +213,6 @@ void operationNameAndVariables(GraphQLTesterSetup setup) throws Exception {
214213
setup.shutdown();
215214
}
216215

217-
@ParameterizedTest
218-
@MethodSource("argumentSource")
219-
void requestBody(GraphQLTesterSetup setup) throws Exception {
220-
221-
String query = "{me {name}}";
222-
setup.response("{\"me\": {\"name\":\"Luke Skywalker\"}}");
223-
224-
RequestInput requestInput = new RequestInput(query, null, null);
225-
String jsonBody = OBJECT_MAPPER.writeValueAsString(requestInput);
226-
227-
GraphQLTester.ResponseSpec spec = setup.graphQLTester().requestBody(jsonBody).execute();
228-
229-
spec.path("me").entity(MovieCharacter.class).isEqualTo(MovieCharacter.create("Luke Skywalker"));
230-
231-
setup.verifyRequest(webInput -> assertThat(webInput.getQuery()).isEqualTo(query));
232-
setup.shutdown();
233-
}
234-
235216
@ParameterizedTest
236217
@MethodSource("argumentSource")
237218
void errorsAssertedIfNotChecked(GraphQLTesterSetup setup) throws Exception {

0 commit comments

Comments
 (0)