http

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WrapHTTPHeader

func WrapHTTPHeader(headers http.Header) api.HeaderMap

func WrapHTTPRequest

func WrapHTTPRequest(req *http.Request) api.HTTPRequest

func WrapHTTPResponse

func WrapHTTPResponse(resp *http.Response) api.HTTPResponse

Types

type HTTPRequest

type HTTPRequest struct {
	Request *http.Request
}

func (*HTTPRequest) Body

func (r *HTTPRequest) Body() io.ReadCloser

func (*HTTPRequest) Connection

func (r *HTTPRequest) Connection() network.Connection

func (*HTTPRequest) HTTPProtocol

func (r *HTTPRequest) HTTPProtocol() string

func (*HTTPRequest) Header

func (r *HTTPRequest) Header() api.HeaderMap

func (*HTTPRequest) Host

func (r *HTTPRequest) Host() string

func (*HTTPRequest) Method

func (r *HTTPRequest) Method() string

func (*HTTPRequest) SetBody

func (r *HTTPRequest) SetBody(body io.ReadCloser)

func (*HTTPRequest) Trailer

func (r *HTTPRequest) Trailer() api.HeaderMap

func (*HTTPRequest) URL

func (r *HTTPRequest) URL() *url.URL

type HTTPResponse

type HTTPResponse struct {
	Response *http.Response
}

func (*HTTPResponse) Body

func (r *HTTPResponse) Body() io.ReadCloser

func (*HTTPResponse) Connection

func (r *HTTPResponse) Connection() network.Connection

func (*HTTPResponse) ContentLength

func (r *HTTPResponse) ContentLength() int64

func (*HTTPResponse) GetHTTPResponse

func (r *HTTPResponse) GetHTTPResponse() *http.Response

func (*HTTPResponse) Header

func (r *HTTPResponse) Header() api.HeaderMap

func (*HTTPResponse) SetBody

func (r *HTTPResponse) SetBody(body io.ReadCloser)

func (*HTTPResponse) StatusCode

func (r *HTTPResponse) StatusCode() int

func (*HTTPResponse) Trailer

func (r *HTTPResponse) Trailer() api.HeaderMap

type HTTPTransport

type HTTPTransport struct {
	MiddlewareHandler
	// contains filtered or unexported fields
}

func NewHTTPTransport

func NewHTTPTransport(transport http.RoundTripper, streamHandler api.StreamHandler, logger logr.Logger) *HTTPTransport

func (*HTTPTransport) Logger

func (t *HTTPTransport) Logger() logr.Logger

func (*HTTPTransport) RoundTrip

func (t *HTTPTransport) RoundTrip(r *http.Request) (*http.Response, error)

type HandleMiddleware

type HandleMiddleware interface {
	BeforeRequest(req api.HTTPRequest, stream api.Stream)
	AfterRequest(req api.HTTPRequest, stream api.Stream)
	BeforeResponse(resp api.HTTPResponse, stream api.Stream)
	AfterResponse(resp api.HTTPResponse, stream api.Stream)
}

type Handler

type Handler interface {
	http.Handler

	Logger() logr.Logger
	AddMiddleware(middleware HandleMiddleware)
	RemoveMiddleware(middleware HandleMiddleware)
}

func NewHandler

func NewHandler(handler http.Handler, streamHandler api.StreamHandler, direction api.ListenerDirection) Handler

type MiddlewareHandler

type MiddlewareHandler interface {
	HandleMiddleware

	AddMiddleware(middleware HandleMiddleware)
	RemoveMiddleware(middleware HandleMiddleware)
	GetMiddlewares() Middlewares
}

func NewMiddlewareHandler

func NewMiddlewareHandler() MiddlewareHandler

type Middlewares

type Middlewares map[HandleMiddleware]struct{}

Jump to

Keyboard shortcuts

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