httputil

package
v0.0.0-...-a65126b Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2022 License: Apache-2.0 Imports: 4 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get2ndPathSegment

func Get2ndPathSegment(r *http.Request, firstSegment string) string

func GetBodyAsString

func GetBodyAsString(r *http.Request) string

func GetUrlComponents

func GetUrlComponents(r *http.Request) []string

Copied from OpenLamda src getUrlComponents parses request URL into its "/" delimated components

func ReplaceBodyWithString

func ReplaceBodyWithString(r *http.Request, newStrBody string)

func RespondWithError

func RespondWithError(w http.ResponseWriter, err *HttpError)

Types

type AppendResponseWriter

type AppendResponseWriter struct {
	Body   []byte
	Status int
	// contains filtered or unexported fields
}

func NewAppendResponseWriter

func NewAppendResponseWriter() *AppendResponseWriter

func (*AppendResponseWriter) Header

func (this *AppendResponseWriter) Header() http.Header

func (*AppendResponseWriter) Write

func (this *AppendResponseWriter) Write(body []byte) (int, error)

func (*AppendResponseWriter) WriteHeader

func (this *AppendResponseWriter) WriteHeader(status int)

type HttpError

type HttpError struct {
	Msg  string
	Code int
}

func New400Error

func New400Error(msg string) *HttpError

func New500Error

func New500Error(msg string) *HttpError

type ObserverResponseWriter

type ObserverResponseWriter struct {
	Body   []byte
	Status int
	// contains filtered or unexported fields
}

func NewObserverResponseWriter

func NewObserverResponseWriter(rw http.ResponseWriter) *ObserverResponseWriter

func (*ObserverResponseWriter) Header

func (this *ObserverResponseWriter) Header() http.Header

func (*ObserverResponseWriter) Write

func (this *ObserverResponseWriter) Write(body []byte) (int, error)

func (*ObserverResponseWriter) WriteHeader

func (this *ObserverResponseWriter) WriteHeader(status int)

Jump to

Keyboard shortcuts

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