http

package
v0.0.0-...-3a511c3 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EncodingAcceptHeader   = "Accept-Encoding"
	EncodingResponseHeader = "Content-Encoding"
)
View Source
const (
	ContentLengthHeader = "Content-Length"
)
View Source
const ContentTypeHeader = "Content-Type"

Variables

This section is empty.

Functions

func NewSimpleJSONResponse

func NewSimpleJSONResponse(obj interface{}) (http.Handler, error)

NewSimpleJSONResponse returns handler which server static json on GET request

func NewWriter

func NewWriter(w http.ResponseWriter, stream io.Writer) http.ResponseWriter

func RequestInvoke

func RequestInvoke[T interface{}](invoker RequestInvoker, request *http.Request) (*T, int, error)

func WithBuffer

func WithBuffer(maxSize int, in http.HandlerFunc) http.HandlerFunc

func WithContentType

func WithContentType(content string, in http.HandlerFunc) http.HandlerFunc

func WithEncoding

func WithEncoding(in http.HandlerFunc) http.HandlerFunc

func WithGZipEncoding

func WithGZipEncoding(in http.HandlerFunc) http.HandlerFunc

func WithIdentityEncoding

func WithIdentityEncoding(in http.HandlerFunc) http.HandlerFunc

func WithNoContent

func WithNoContent(in http.HandlerFunc) http.HandlerFunc

func WithTextContentType

func WithTextContentType(in http.HandlerFunc) http.HandlerFunc

Types

type Buffer

type Buffer interface {
	io.Writer

	Bytes() []byte
	Truncated() bool
}

func NewBuffer

func NewBuffer(maxSize int, upstream io.Writer) Buffer

type Headers

type Headers map[string]float64

func ParseHeaders

func ParseHeaders(in ...string) Headers

func (Headers) Accept

func (h Headers) Accept(headers ...string) string

type PlainServer

type PlainServer interface {
	Server
	WithSSL(key, cert string) (Server, error)
	WithKeyfile(keyfile string) (Server, error)
}

func NewServer

func NewServer(server *http.Server) PlainServer

type RequestInvoker

type RequestInvoker interface {
	Do(req *http.Request) (*http.Response, error)
}

type Server

type Server interface {
	Start() (ServerRunner, error)
}

type ServerRunner

type ServerRunner interface {
	Stop()
	Wait() error
}

Jump to

Keyboard shortcuts

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