gqlgen: github.com/99designs/gqlgen/graphql/handler/transport Index | Files

package transport

import "github.com/99designs/gqlgen/graphql/handler/transport"

Index

Package Files

error.go http_form.go http_get.go http_post.go options.go reader.go util.go websocket.go websocket_init.go

func SendError Uses

func SendError(w http.ResponseWriter, code int, errors ...*gqlerror.Error)

SendError sends a best effort error to a raw response writer. It assumes the client can understand the standard json error response

func SendErrorf Uses

func SendErrorf(w http.ResponseWriter, code int, format string, args ...interface{})

SendErrorf wraps SendError to add formatted messages

type GET Uses

type GET struct{}

GET implements the GET side of the default HTTP transport defined in https://github.com/APIs-guru/graphql-over-http#get

func (GET) Do Uses

func (h GET) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)

func (GET) Supports Uses

func (h GET) Supports(r *http.Request) bool

type InitPayload Uses

type InitPayload map[string]interface{}

InitPayload is a structure that is parsed from the websocket init message payload. TO use request headers for non-websocket, instead wrap the graphql handler in a middleware.

func GetInitPayload Uses

func GetInitPayload(ctx context.Context) InitPayload

GetInitPayload gets a map of the data sent with the connection_init message, which is used by graphql clients as a stand-in for HTTP headers.

func (InitPayload) Authorization Uses

func (p InitPayload) Authorization() string

Authorization is a short hand for getting the Authorization header from the payload.

func (InitPayload) GetString Uses

func (p InitPayload) GetString(key string) string

GetString safely gets a string value from the payload. It returns an empty string if the payload is nil or the value isn't set.

type MultipartForm Uses

type MultipartForm struct {
    // MaxUploadSize sets the maximum number of bytes used to parse a request body
    // as multipart/form-data.
    MaxUploadSize int64

    // MaxMemory defines the maximum number of bytes used to parse a request body
    // as multipart/form-data in memory, with the remainder stored on disk in
    // temporary files.
    MaxMemory int64
}

MultipartForm the Multipart request spec https://github.com/jaydenseric/graphql-multipart-request-spec

func (MultipartForm) Do Uses

func (f MultipartForm) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)

func (MultipartForm) Supports Uses

func (f MultipartForm) Supports(r *http.Request) bool

type Options Uses

type Options struct{}

Options responds to http OPTIONS and HEAD requests

func (Options) Do Uses

func (o Options) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)

func (Options) Supports Uses

func (o Options) Supports(r *http.Request) bool

type POST Uses

type POST struct{}

POST implements the POST side of the default HTTP transport defined in https://github.com/APIs-guru/graphql-over-http#post

func (POST) Do Uses

func (h POST) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)

func (POST) Supports Uses

func (h POST) Supports(r *http.Request) bool

type Websocket Uses

type Websocket struct {
    Upgrader              websocket.Upgrader
    InitFunc              WebsocketInitFunc
    KeepAlivePingInterval time.Duration
}

func (Websocket) Do Uses

func (t Websocket) Do(w http.ResponseWriter, r *http.Request, exec graphql.GraphExecutor)

func (Websocket) Supports Uses

func (t Websocket) Supports(r *http.Request) bool

type WebsocketInitFunc Uses

type WebsocketInitFunc func(ctx context.Context, initPayload InitPayload) (context.Context, error)

Package transport imports 19 packages (graph) and is imported by 15 packages. Updated 2020-03-05. Refresh now. Tools for package owners.