leto_shelf
library
Functions
altairHandler ({AltairConfig config = const AltairConfig() })
→ Handler
cors ({FutureOr <bool > allowOrigin (String ) = _defaultAllowOrigin , bool allowCredentials = true , int maxAgeSecs = 30 * 60 , List <String > allowMethods = _defaultAllowMethods , int optionsSuccessStatusCode = 204 })
→ Middleware
createMiddleware ({FutureOr <Response ? > requestHandler (Request )?, FutureOr <Response > responseHandler (Response )?, FutureOr <Response > errorHandler (Object error , StackTrace )? })
→ Middleware
Creates a Middleware using the provided functions.
customLog ({void log (String )? })
→ Middleware
etag ({Future <String > hasher (Stream <List <int > > , Encoding ? )?, bool shouldProcessResponse (Request , Response ) = _defaultShouldProcessResponse })
→ Middleware
Returns the request associated with this ctx
Returns the request associated with this ctx
Returns the response associated with this ctx
Returns the response associated with this ctx
graphiqlHandler ({required GraphiqlFetcher fetcher , GraphiqlConfig ? config })
→ Handler
graphQLHttp (GraphQL graphQL , {List <ScopedOverride > ? scopeOverrides , Response onEmptyGet (Request )?, Response onError (Request , Object , StackTrace )? })
→ Handler
The main GraphQL over HTTP shelf handler.
GET for Queries with arguments in query parameters.
POST for Mutations with content types:
graphQLWebSocket (GraphQL graphQL , {Iterable <String > ? allowedOrigins , Duration ? keepAliveInterval , Duration ? pingInterval , Duration ? connectionInitWaitTimeout , List <ScopedOverride > ? scopeOverrides , FutureOr <bool > validateIncomingConnection (Map <String , Object ? > ? payload , GraphQLWebSocketShelfServer server )? })
→ Handler
A shelf Handler that serves a spec-compliant
GraphQL backend over WebSockets.
This endpoint only supports WebSockets, and can be used
to deliver subscription events as well as queries and mutations.
jsonParse ()
→ Middleware
logRequests ({void logger (String message , bool isError )? })
→ Middleware
Middleware which prints the time of the request, the elapsed time for the
inner handlers, the response's status code and the request URI.
makeAltairHtml (AltairConfig options )
→ String
makeGraphiqlHtml ({required GraphiqlFetcher fetcher , GraphiqlConfig ? config })
→ String
makePlaygroundHtml ({PlaygroundConfig ? config })
→ String
makeRequestScopedMap (Request request , {required bool isFromWebSocket })
→ RequestOverrides
Creates a scope with leto_shelf request state
playgroundHandler ({PlaygroundConfig ? config })
→ Handler
setEtag (Response response , String etag )
→ Response
updateResponse (Ctx ctx , Response update (Response ) )
→ Response
Updates the response associated with this resolver context
Exceptions / Errors
HijackException
An exception used to indicate that a request has been hijacked.