Function finchers_juniper::request::graphql_request [−][src]
pub fn graphql_request() -> GraphQLRequestEndpoint
Create an endpoint which parses a GraphQL request from the client.
This endpoint validates if the HTTP method is GET or POST and if the iterator over remaining segments is empty, and skips if the request is not acceptable. If the validation is successed, it will return a Future which behaves as follows:
- If the method is
GET
, the query in the request is parsed as a single GraphQL query. If the query string is missing, it will return an error. - If the method is
POST
, receives the all contents of the request body and then converts it into a value ofGraphQLRequest
.- When
content-type
isapplication/json
, the body is parsed as a JSON object which contains a GraphQL query and supplemental fields if needed. - When
content-type
isapplication/graphql
, the body is parsed as a single GraphQL query.
- When