exchange

package
v0.0.0-...-af040d2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Exchange

type Exchange struct {
	Request         *http.Request
	ResponseWriter  http.ResponseWriter
	Fields          map[string]string
	CappedBody      io.Reader
	RoutedPath      string
	OriginalPath    string
	RoutedRawPath   string
	OriginalRawPath string
	ServerSpec      spec.Spec
}

func New

func New(w http.ResponseWriter, req *http.Request, serverSpec spec.Spec) *Exchange

func (Exchange) BodyBytes

func (ex Exchange) BodyBytes() []byte

func (Exchange) BodyString

func (ex Exchange) BodyString() string

func (Exchange) ExposableHeadersMap

func (ex Exchange) ExposableHeadersMap() map[string]any

func (Exchange) Field

func (ex Exchange) Field(name string) string

func (Exchange) FindIncomingIPAddress

func (ex Exchange) FindIncomingIPAddress() string

FindIncomingIPAddress Find the IP address of the client that made this Exchange.

func (Exchange) FindScheme

func (ex Exchange) FindScheme() string

func (Exchange) Finish

func (ex Exchange) Finish(resp response.Response)

func (Exchange) FormParamSingle

func (ex Exchange) FormParamSingle(name string) (string, error)

func (Exchange) FullUrl

func (ex Exchange) FullUrl() string

func (Exchange) HeaderValueLast

func (ex Exchange) HeaderValueLast(name string) string

func (Exchange) MatchAndLoadFields

func (ex Exchange) MatchAndLoadFields(routePat regexp.Regexp) bool

func (Exchange) QueryParamInt

func (ex Exchange) QueryParamInt(name string, value int) (int, error)

func (Exchange) QueryParamSingle

func (ex Exchange) QueryParamSingle(name string) (string, error)

func (Exchange) Redirect

func (ex Exchange) Redirect(target string)

func (Exchange) RespondBadRequest

func (ex Exchange) RespondBadRequest(message string, vars ...any)

func (Exchange) RespondError

func (ex Exchange) RespondError(status int, code, detail string)

func (Exchange) RespondWithStatus

func (ex Exchange) RespondWithStatus(errorStatus int)

func (Exchange) Write

func (ex Exchange) Write(content string)

func (Exchange) WriteBytes

func (ex Exchange) WriteBytes(content []byte)

func (Exchange) WriteF

func (ex Exchange) WriteF(content string, vars ...any)

func (Exchange) WriteJSON

func (ex Exchange) WriteJSON(data any)

func (Exchange) WriteLn

func (ex Exchange) WriteLn(content string)

type HandlerFn

type HandlerFn func(ex *Exchange)

type HandlerFn2

type HandlerFn2 func(ex *Exchange) response.Response

Jump to

Keyboard shortcuts

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