http

package module
v0.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: GPL-3.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandlerCORS

func HandlerCORS(origin string, h http.Handler) http.Handler

HandlerCORS wraps h to accept CORS requests from the specified origin.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

A Client that exchanges data with a set endpoint through HTTP POST.

func ClientMake

func ClientMake(addr string, cli *http.Client) Client

ClientMake returns a unsable Client. cli may be nil, in which case the default http client is used.

func (Client) Writer

func (x Client) Writer() (msg.ExchangeWriter, error)

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

Handler is a bridge between standard http request handling and the msg framework.

The zero value is directly usable.

func (*Handler) ReaderChain

func (x *Handler) ReaderChain(ert msg.ExchangeReaderTaker) error

In order to return a http BadRequest, [ert] should return an error when reading, without using the associated response Writer. In any other case, a http OK will be returned, as well as any data written by the time [ert.ReaderTake] returns.

func (*Handler) ServeHTTP

func (x *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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