Module http

Source
Expand description

Helpers for building Spin wasi-http components.

Modules§

conversions
Traits for converting between the various types
responses
Helper functions for creating responses

Macros§

http_router
A macro to help with constructing a Router from a stream of tokens.

Structs§

Body
A Body extractor
Fields
A common representation for headers and trailers.
HeaderValue
A header value.
IncomingRequest
Represents an incoming HTTP request.
IncomingResponse
Represents an incoming HTTP Response.
Json
A Json extractor
JsonBodyError
An error parsing a JSON body
NonUtf8BodyError
An error when the body is not UTF-8
OutgoingBody
Represents an outgoing HTTP Request or Response’s Body.
OutgoingRequest
Represents an outgoing HTTP Request.
OutgoingResponse
Represents an outgoing HTTP response.
Request
A unified request object that can represent both incoming and outgoing requests.
RequestBuilder
A builder for non-streaming outgoing HTTP requests. You can obtain a RequestBuilder from the Request::builder() method, or from method-specific helpers such as Request::get() or Request::post().
Response
A unified response object that can represent both outgoing and incoming responses.
ResponseBuilder
A builder for `Response``
ResponseOutparam
A parameter provided by Spin for setting a streaming OutgoingResponse.
Router
Routes HTTP requests within a Spin component.

Enums§

ErrorCode
These cases are inspired by the IANA HTTP Proxy Error Types: https://www.iana.org/assignments/http-proxy-status/http-proxy-status.xhtml#table-http-proxy-error-types
Method
This type corresponds to HTTP standard Methods.
Scheme
This type corresponds to HTTP standard Related Schemes.
SendError
An error encountered when performing an HTTP request

Traits§

Handler
An HTTP request handler.
IntoResponse
A trait for any type that can be turned into a Response

Functions§

send
Send an outgoing request

Type Aliases§

Headers
Headers is an alias for Fields.
Params
Route parameters extracted from a URI that match a route pattern.
StatusCode
This type corresponds to the HTTP standard Status Code.
Trailers
Trailers is an alias for Fields.