httpadapter

package
v0.0.0-...-67f803e Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EventToRequest

func EventToRequest(req events.LambdaFunctionURLRequest) (*http.Request, error)

EventToRequest converts an API Gateway proxy event into an http.Request object. Returns the populated request maintaining headers

Types

type URLResponseWriter

type URLResponseWriter struct {
	// contains filtered or unexported fields
}

URLResponseWriter implements http.ResponseWriter and adds the method necessary to return an events.APIGatewayProxyResponse object

func NewURLResponseWriter

func NewURLResponseWriter() *URLResponseWriter

NewURLResponseWriter returns a new URLResponseWriter object. The object is initialized with an empty map of headers and a status code of -1

func (*URLResponseWriter) CloseNotify

func (r *URLResponseWriter) CloseNotify() <-chan bool

func (*URLResponseWriter) GetProxyResponse

func (r *URLResponseWriter) GetProxyResponse() (events.LambdaFunctionURLResponse, error)

GetProxyResponse converts the data passed to the response writer into an events.APIGatewayProxyResponse object. Returns a populated proxy response object. If the response is invalid, for example has no headers or an invalid status code returns an error.

func (*URLResponseWriter) Header

func (r *URLResponseWriter) Header() http.Header

Header implementation from the http.ResponseWriter interface.

func (*URLResponseWriter) Write

func (r *URLResponseWriter) Write(body []byte) (int, error)

Write sets the response body in the object. If no status code was set before with the WriteHeader method it sets the status for the response to 200 OK.

func (*URLResponseWriter) WriteHeader

func (r *URLResponseWriter) WriteHeader(status int)

WriteHeader sets a status code for the response. This method is used for error responses.

Jump to

Keyboard shortcuts

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