http

package
v0.12.6 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2022 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadRequest

func BadRequest(c *gin.Context, err interface{})

BadRequest renders a HTTP 400 bad request response

func JsonOK

func JsonOK(c *gin.Context, data interface{})

JsonOK renders a successful response

func NotFound

func NotFound(c *gin.Context, err interface{})

NotFound renders a HTTP 404 not found response

func ServerError

func ServerError(c *gin.Context, err interface{})

ServerError renders a HTTP 500 error response

func ShouldReturn

func ShouldReturn(c *gin.Context, err error) bool

ShouldReturn is a shorthand method for handling resource errors

Types

type BadRequestResponse added in v0.8.3

type BadRequestResponse = ErrorResponse

swagger:response BadRequestResponse

type ErrorResponse added in v0.8.3

type ErrorResponse struct {
	Status int         `json:"status"`
	Error  interface{} `json:"error"`
}

Jump to

Keyboard shortcuts

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