http

package
v2.4.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2020 License: Apache-2.0 Imports: 10 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRoundTripper

func NewRoundTripper(opts ...Option) http.RoundTripper

func RequestToContext added in v2.4.0

func RequestToContext(r *http.Request) context.Context

RequestToContext puts the `Authorization` header bearer token into context so calls to services will be authorized.

func Write added in v2.3.0

func Write(w http.ResponseWriter, contentType string, status int, body string)

Write sets the status and body on a http ResponseWriter

func WriteBadRequestError added in v2.3.0

func WriteBadRequestError(w http.ResponseWriter, err error)

WriteBadRequestError sets a 400 status code

func WriteInternalServerError added in v2.3.0

func WriteInternalServerError(w http.ResponseWriter, err error)

WriteInternalServerError sets a 500 status code

Types

type Option

type Option func(*Options)

func WithRegistry

func WithRegistry(r registry.Registry) Option

type Options

type Options struct {
	Registry registry.Registry
}

Jump to

Keyboard shortcuts

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