request

package
v0.15.2 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2022 License: Apache-2.0 Imports: 7 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CoordinatedRequest

type CoordinatedRequest struct {
	Method       string            `json:"method"`
	URL          string            `json:"url"`
	ID           string            `json:"request_id"`
	Body         []byte            `json:"body"`
	Headers      map[string]string `json:"headers"`
	RespHeaders  map[string]string `json:"resp_headers"`
	Params       map[string]string `json:"params"`
	State        map[string][]byte `json:"state"`
	SequenceJSON []byte            `json:"sequence_json,omitempty"`
	// contains filtered or unexported fields
}

CoordinatedRequest represents a request whose fulfillment can be coordinated across multiple hosts and is serializable to facilitate interoperation with Wasm Runnables and transmissible over the wire

func FromJSON

func FromJSON(jsonBytes []byte) (*CoordinatedRequest, error)

FromJSON unmarshalls a CoordinatedRequest from JSON

func FromVKRequest

func FromVKRequest(r *http.Request, ctx *vk.Ctx) (*CoordinatedRequest, error)

FromVKRequest creates a CoordinatedRequest from an VK request handler

func (*CoordinatedRequest) BodyField

func (c *CoordinatedRequest) BodyField(key string) (string, error)

BodyField returns a field from the request body as a string

func (*CoordinatedRequest) SetBodyField added in v0.13.0

func (c *CoordinatedRequest) SetBodyField(key, val string) error

SetBodyField sets a field in the JSON body to a new value

func (*CoordinatedRequest) ToJSON

func (c *CoordinatedRequest) ToJSON() ([]byte, error)

ToJSON returns a JSON representation of a CoordinatedRequest

func (*CoordinatedRequest) UseHeadlessHeaders added in v0.14.0

func (c *CoordinatedRequest) UseHeadlessHeaders(r *http.Request, ctx *vk.Ctx) error

UseHeadlessHeaders adds the values in the state and params headers JSON to the CoordinatedRequest's State and Params

type CoordinatedResponse added in v0.8.1

type CoordinatedResponse struct {
	Output      []byte            `json:"output"`
	RespHeaders map[string]string `json:"resp_headers"`
}

func ResponseFromJSON added in v0.14.0

func ResponseFromJSON(jsonBytes []byte) (*CoordinatedResponse, error)

ResponseFromJSON unmarshalls a CoordinatedResponse from JSON

func (*CoordinatedResponse) ToJSON added in v0.8.1

func (c *CoordinatedResponse) ToJSON() ([]byte, error)

ToJSON returns a JSON representation of a CoordinatedRequest

Jump to

Keyboard shortcuts

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