Documentation
¶
Overview ¶
Package http contains the helper functions for writing Spin HTTP components in Go, as well as for sending outbound HTTP requests.
Index ¶
- Constants
- func Get(url string) (*http.Response, error)
- func Handle(fn func(http.ResponseWriter, *http.Request))
- func NewClient() *http.Client
- func NewTransport() http.RoundTripper
- func Post(url string, contentType string, body io.Reader) (*http.Response, error)
- func Send(req *http.Request) (*http.Response, error)
- type Transport
Constants ¶
View Source
const ( // HeaderBasePath is the application base path. HeaderBasePath = "spin-base-path" // HeaderComponentRoot is the component route pattern matched, excluding any wildcard indicator. HeaderComponentRoot = "spin-component-route" // HeaderFullUrl is the full URL of the request, including full host and scheme information. HeaderFullUrl = "spin-full-url" // HeaderMatchedRoute is the part of the request path that was matched by the route, // including the base and wildcard indicator if present. HeaderMatchedRoute = "spin-matched-route" // HeaderPathInfo is the request path relative to the component route, including any base. HeaderPathInfo = "spin-path-info" // HeaderRawComponentRoot is the component route pattern matched, as written in the component // manifest. It excludes the base but includes the wildcard indicator if present. HeaderRawComponentRoot = "spin-raw-component-route" // HeaderClientAddr is the client address for the request. HeaderClientAddr = "spin-client-addr" )
Variables ¶
This section is empty.
Functions ¶
func Handle ¶
func Handle(fn func(http.ResponseWriter, *http.Request))
Handle sets the handler function for the http trigger. It must be set in an init() function.
func NewTransport ¶
func NewTransport() http.RoundTripper
NewTransport returns an http.RoundTripper backed by the Spin SDK.
Types ¶
Click to show internal directories.
Click to hide internal directories.