Categorygithub.com/matt-ksena/graphql-multipart-middleware
modulepackage
0.0.0-20200607203931-f6e829e4db1d
Repository: https://github.com/matt-ksena/graphql-multipart-middleware.git
Documentation: pkg.go.dev

# README

GraphQL Multipart Middleware

Codacy Badge FOSSA Status Build Status Coverage Status FOSSA Status

This packages provide a implementation of the graphql multipart request spec created by @jaydenseric to provide support for handling file uploads in a GraphQL server, click here to see the spec.

Using the methods graphqlmultipart.NewHandler or graphqlmultipart.NewMiddlewareWrapper you will be abble to wrap your GraphQL handler and so every request made with the Content-Type: multipart/form-data will be handled by this package (using a provided GraphQL schema), and other Content-Types will be directed to your handler.

The package also provide a scalar for the uploaded content called graphqlmultipart.Upload, when used it will populate your InputObjects or arguments with a *multipart.FileHeader for the uploaded file that can be used inside your queries/mutations.

License

FOSSA Status

# Packages

No description provided by the author
No description provided by the author

# Functions

NewHandler wraps the default GraphQL handler within a MultipartHandler, if it receives a request that is not "multipart/form-data", it will be forwarded to the wrapped handler.
NewMiddlewareWrapper retrieves a func to help wrap multiple GraphQL handler with the MultipartHandler.

# Variables

FailedToParseFormMessage is shown when it is a multipart/form-data, but its invalid.
InvalidMapFieldMessage is shown when the map field format is invalid.
InvalidMapPathMessage is shown when is not possible to find or populate the variable path.
InvalidOperationsFieldMessage is shown when operations field format is not valid.
MapFieldMissingMessage is shown when the map field is missing.
MissingFileMessage is shown when a file is mapped, but not sent.
Set equal to true to enable simple CORS, to be used only during testing.
OperationsFieldMissingMessage is shown when the operations field is missing.
Upload is a scalar represents a uploaded file using \"multipart/form-data\" as described in the graphql multipart spec.

# Structs

MultipartHandler implements the specification for handling multipart/form-data see more at: https://github.com/jaydenseric/graphql-multipart-request-spec/tree/v2.0.0.