public class GraphQLTestTemplate
extends java.lang.Object
| Constructor and Description |
|---|
GraphQLTestTemplate() |
| Modifier and Type | Method and Description |
|---|---|
void |
addHeader(java.lang.String name,
java.lang.String value)
Add an HTTP header that will be sent with each request this sends.
|
void |
clearHeaders()
Clear all associated HTTP headers.
|
GraphQLResponse |
perform(java.lang.String graphqlResource)
Deprecated.
Use
postForResource(String) instead |
GraphQLResponse |
perform(java.lang.String graphqlResource,
com.fasterxml.jackson.databind.node.ObjectNode variables) |
GraphQLResponse |
perform(java.lang.String graphqlResource,
com.fasterxml.jackson.databind.node.ObjectNode variables,
java.util.List<java.lang.String> fragmentResources) |
GraphQLResponse |
postForResource(java.lang.String graphqlResource)
Loads a GraphQL query from the given classpath resource and sends it to the GraphQL server.
|
GraphQLResponse |
postForResource(java.lang.String graphqlResource,
java.util.List<java.lang.String> fragmentResources)
Loads a GraphQL query from the given classpath resource, appending any graphql fragment
resources provided and sends it to the GraphQL server.
|
GraphQLResponse |
postMultipart(java.lang.String query,
java.lang.String variables) |
void |
setHeaders(org.springframework.http.HttpHeaders newHeaders)
Replace any associated HTTP headers with the provided headers.
|
public void addHeader(java.lang.String name,
java.lang.String value)
name - Name (key) of HTTP header to add.value - Value of HTTP header to add.public void setHeaders(org.springframework.http.HttpHeaders newHeaders)
newHeaders - Headers to use.public void clearHeaders()
public GraphQLResponse perform(java.lang.String graphqlResource) throws java.io.IOException
postForResource(String) insteadgraphqlResource - path to the classpath resource containing the GraphQL queryjava.io.IOException - if the resource cannot be loaded from the classpathpublic GraphQLResponse perform(java.lang.String graphqlResource, com.fasterxml.jackson.databind.node.ObjectNode variables) throws java.io.IOException
java.io.IOExceptionpublic GraphQLResponse perform(java.lang.String graphqlResource, com.fasterxml.jackson.databind.node.ObjectNode variables, java.util.List<java.lang.String> fragmentResources) throws java.io.IOException
java.io.IOExceptionpublic GraphQLResponse postForResource(java.lang.String graphqlResource) throws java.io.IOException
graphqlResource - path to the classpath resource containing the GraphQL queryjava.io.IOException - if the resource cannot be loaded from the classpathpublic GraphQLResponse postForResource(java.lang.String graphqlResource, java.util.List<java.lang.String> fragmentResources) throws java.io.IOException
graphqlResource - path to the classpath resource containing the GraphQL queryfragmentResources - an ordered list of classpaths containing GraphQL fragment definitions.java.io.IOException - if the resource cannot be loaded from the classpathpublic GraphQLResponse postMultipart(java.lang.String query, java.lang.String variables)