responses

package
v1.206.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ContentTypeJSONHeader = map[string]string{"Content-Type": "application/json"}

Functions

func BadRequestResponse

func BadRequestResponse(err error) (events.APIGatewayProxyResponse, error)

BadRequestResponse - invalid user input

func FoundResponse added in v1.197.0

func FoundResponse(url string) events.APIGatewayProxyResponse

func GenericResponse

func GenericResponse(statusCode int, body string, headers map[string]string) (events.APIGatewayProxyResponse, error)

GenericResponse - called by the other functions

func GenericSuccessResponse

func GenericSuccessResponse(message string) (events.APIGatewayProxyResponse, error)

SuccessResponse - everything worked

func InternalServerErrorResponse

func InternalServerErrorResponse(err error) (events.APIGatewayProxyResponse, error)

InternalServerErrorResponse - something went wrong

func JSONSuccessResponse

func JSONSuccessResponse(body interface{}) (events.APIGatewayProxyResponse, error)

JSONSuccessResponse - try to JSONify any struct and send it as the body of a successful response Return an internal server error if JSON marshalling fails NOTE: struct fields must be exported (i.e. Capitalised) and tagged

func LockedResponse

func LockedResponse(err error) (events.APIGatewayProxyResponse, error)

func MaintenanceResponse

func MaintenanceResponse(message string) events.APIGatewayProxyResponse

func MovedPermanentlyResponse added in v1.178.0

func MovedPermanentlyResponse(url string) events.APIGatewayProxyResponse

func NoContent

func NoContent() (events.APIGatewayProxyResponse, error)

func NotFoundResponse

func NotFoundResponse(err error) (events.APIGatewayProxyResponse, error)

NotFoundResponse - 404

func OptionsResponse

func OptionsResponse() events.APIGatewayProxyResponse

func RateLimitResponse

func RateLimitResponse(message string) events.APIGatewayProxyResponse

func SuccessResponse

func SuccessResponse(body string) (events.APIGatewayProxyResponse, error)

SuccessResponse - everything worked

func TooManyRequests

func TooManyRequests(message string) (events.APIGatewayProxyResponse, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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