http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2023 License: Apache-2.0 Imports: 9 Imported by: 20

Documentation

Overview

Package http contains the helper functions for writing Spin HTTP components in TinyGo, as well as for sending outbound HTTP requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get(url string) (*http.Response, error)

Get creates a GET HTTP request to a given URL and returns the HTTP response. The destination of the request must be explicitly allowed in the Spin application configuration, otherwise the request will not be sent.

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 Post

func Post(url string, contentType string, body io.Reader) (*http.Response, error)

Post creates a POST HTTP request and returns the HTTP response. The destination of the request must be explicitly allowed in the Spin application configuration, otherwise the request will not be sent.

func Send

func Send(req *http.Request) (*http.Response, error)

Send sends an HTTP request and return the HTTP response. The destination of the request must be explicitly allowed in the Spin application configuration, otherwise the request will not be sent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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