use of com.apollographql.apollo.internal.json.InputFieldJsonWriter in project apollo-android by apollographql.
the class ApolloServerInterceptor method httpRequestBody.
private RequestBody httpRequestBody(Operation operation) throws IOException {
Buffer buffer = new Buffer();
JsonWriter jsonWriter = JsonWriter.of(buffer);
jsonWriter.setSerializeNulls(true);
jsonWriter.beginObject();
if (sendOperationIdentifiers) {
jsonWriter.name("id").value(operation.operationId());
} else {
jsonWriter.name("query").value(operation.queryDocument().replaceAll("\\n", ""));
}
jsonWriter.name("variables").beginObject();
operation.variables().marshaller().marshal(new InputFieldJsonWriter(jsonWriter, scalarTypeAdapters));
jsonWriter.endObject();
jsonWriter.endObject();
jsonWriter.close();
return RequestBody.create(MEDIA_TYPE, buffer.readByteString());
}
Aggregations