Module cowboy_graphql_http_handler

Cowboy HTTP handler for graphql API.

Copyright © (C) 2021, Sergey

Behaviours: cowboy_loop.

Authors: Sergey (me@seriyps.ru).

Description

Cowboy HTTP handler for graphql API

It supports following REQUEST methods: * HTTP GET with query, operationName, variables, extensions query string parameters * HTTP POST with application/json payload * HTTP POST with application/x-www-form-urlencoded payload For POST payload is negotiated via Content-Type header See https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md

It supports following RESPONSE methods (negotiated via Accept header): * application/json (only single reply can be delivered) See https://github.com/graphql/graphql-over-http/blob/main/spec/GraphQLOverHTTP.md#response * multipart/mixed (multiple replies can be delivered, including subscription stream) See https://github.com/graphql/graphql-over-http/blob/main/rfcs/IncrementalDelivery.md

We don't use application/graphql-response+json yet, just application/json. Non-graphql-execution errors are also reported as application/json

Data Types

config()

abstract datatype: config()

features()

features() = #{method => post | get, payload_type => query_string | input_content_type(), response_type => output_content_type()}

input_content_type()

input_content_type() = json | x_www_form_urlencoded

options()

options() = #{accept_body => [input_content_type()], response_types => [output_content_type()], allowed_methods => [post | get], json_mod => module(), max_body_size => pos_integer(), heartbeat => pos_integer() | undefined, timeout => timeout() | undefined}

output_content_type()

output_content_type() = json | multipart

Function Index

config/3
format_error/2
info/3
init/2
terminate/3

Function Details

config/3

config(Callback::module(), CallbackOptions::any(), TransportOptions::options()) -> config()

format_error/2

format_error(Allowed, Err) -> any()

info/3

info(Msg, Req0, St) -> any()

init/2

init(Req, X2) -> any()

terminate/3

terminate(Reason, PartialReq, State) -> any()


Generated by EDoc