transport

package
v0.12.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2020 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SendError

func SendError(ctx *fasthttp.RequestCtx, 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

func SendErrorf(ctx *fasthttp.RequestCtx, code int, format string, args ...interface{})

SendErrorf wraps SendError to add formatted messages

Types

type GET

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

func (h GET) Do(ctx *fasthttp.RequestCtx, exec graphql.GraphExecutor)

func (GET) Supports

func (h GET) Supports(ctx *fasthttp.RequestCtx) bool

type InitPayload

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

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

func (p InitPayload) Authorization() string

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

func (InitPayload) GetString

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

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

func (MultipartForm) Supports

func (f MultipartForm) Supports(ctx *fasthttp.RequestCtx) bool

type Options

type Options struct{}

Options responds to http OPTIONS and HEAD requests

func (Options) Do

func (o Options) Do(ctx *fasthttp.RequestCtx, exec graphql.GraphExecutor)

func (Options) Supports

func (o Options) Supports(ctx *fasthttp.RequestCtx) bool

type POST

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

func (h POST) Do(ctx *fasthttp.RequestCtx, exec graphql.GraphExecutor)

func (POST) Supports

func (h POST) Supports(ctx *fasthttp.RequestCtx) bool

type Websocket

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

func (Websocket) Do

func (Websocket) Supports

func (t Websocket) Supports(ctx *fasthttp.RequestCtx) bool

type WebsocketInitFunc

type WebsocketInitFunc func(ctx *fasthttp.RequestCtx, initPayload InitPayload) (*fasthttp.RequestCtx, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL