Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void buildPostRoute(TarantoolClient tarantoolClient) {
- router.post("/post")
- .handler(rc -> tarantoolClient.graphql(rc.getBodyAsJson())
- .onSuccess(httpResp -> {
- if (
- httpResp.statusCode() == 200
- && !httpResp.getHeader("content-type").contentEquals("application/json")
- ) {
- rc.end(httpResp.bodyAsBuffer());
- } else {
- log.error("GraphQL query not found");
- rc.response()
- .setStatusCode(400)
- .putHeader("Content-Type", "application/json")
- .end(
- new JsonObject()
- .put("message", httpResp.statusMessage())
- .toBuffer()
- );
- }
- })
- );
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement