Documentation
¶
Overview ¶
Httpserver: wasmcloud capability contract for http server
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func HttpServerContractId ¶
func HttpServerContractId() string
HttpServerContractId returns the capability contract id for this interface
func HttpServerHandler ¶
func HttpServerHandler(actor_ HttpServer) actor.Handler
HttpServerHandler is called by an actor during `main` to generate a dispatch handler The output of this call should be passed into `actor.RegisterHandlers`
Types ¶
type HeaderMap ¶
type HeaderMap map[string]HeaderValues
map data structure for holding http headers
func CDecodeHeaderMap ¶
CDecodeHeaderMap deserializes a HeaderMap using cbor
func MDecodeHeaderMap ¶
MDecodeHeaderMap deserializes a HeaderMap using msgpack
type HeaderValues ¶
type HeaderValues []string
func CDecodeHeaderValues ¶
func CDecodeHeaderValues(d *cbor.Decoder) (HeaderValues, error)
CDecodeHeaderValues deserializes a HeaderValues using cbor
func MDecodeHeaderValues ¶
func MDecodeHeaderValues(d *msgpack.Decoder) (HeaderValues, error)
MDecodeHeaderValues deserializes a HeaderValues using msgpack
type HttpRequest ¶
type HttpRequest struct { // HTTP method. One of: GET,POST,PUT,DELETE,HEAD,OPTIONS,CONNECT,PATCH,TRACE Method string // full request path Path string // query string. May be an empty string if there were no query parameters. QueryString string // map of request headers (string key, string value) Header HeaderMap // Request body as a byte array. May be empty. Body []byte }
HttpRequest contains data sent to actor about the http request
func CDecodeHttpRequest ¶
func CDecodeHttpRequest(d *cbor.Decoder) (HttpRequest, error)
CDecodeHttpRequest deserializes a HttpRequest using cbor
func MDecodeHttpRequest ¶
func MDecodeHttpRequest(d *msgpack.Decoder) (HttpRequest, error)
MDecodeHttpRequest deserializes a HttpRequest using msgpack
type HttpResponse ¶
type HttpResponse struct { // statusCode is a three-digit number, usually in the range 100-599, // A value of 200 indicates success. StatusCode uint16 // Map of headers (string keys, list of values) Header HeaderMap // Body of response as a byte array. May be an empty array. Body []byte }
HttpResponse contains the actor's response to return to the http client
func CDecodeHttpResponse ¶
func CDecodeHttpResponse(d *cbor.Decoder) (HttpResponse, error)
CDecodeHttpResponse deserializes a HttpResponse using cbor
func MDecodeHttpResponse ¶
func MDecodeHttpResponse(d *msgpack.Decoder) (HttpResponse, error)
MDecodeHttpResponse deserializes a HttpResponse using msgpack
type HttpServer ¶
type HttpServer interface {
HandleRequest(ctx *actor.Context, arg HttpRequest) (*HttpResponse, error)
}
HttpServer is the contract to be implemented by actor
type HttpServerReceiver ¶
type HttpServerReceiver struct{}
HttpServerReceiver receives messages defined in the HttpServer service interface HttpServer is the contract to be implemented by actor
func (*HttpServerReceiver) Dispatch ¶
func (r *HttpServerReceiver) Dispatch(ctx *actor.Context, svc interface{}, message *actor.Message) (*actor.Message, error)
type HttpServerSender ¶
type HttpServerSender struct {
// contains filtered or unexported fields
}
HttpServerSender sends messages to a HttpServer service HttpServer is the contract to be implemented by actor
func NewActorHttpServerSender ¶
func NewActorHttpServerSender(actor_id string) *HttpServerSender
NewActorSender constructs a client for actor-to-actor messaging using the recipient actor's public key
func (*HttpServerSender) HandleRequest ¶
func (s *HttpServerSender) HandleRequest(ctx *actor.Context, arg HttpRequest) (*HttpResponse, error)