httputil

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: May 3, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindData

func BindData(c *gin.Context, data interface{}) (int, error)

BindData binds the data from the request to the struct passed in the interface.

func FetchErrorHandler

func FetchErrorHandler(c *gin.Context, err error)

FetchErrorHandler handles errors for fetching data from the database.

func NewError

func NewError(c *gin.Context, status int, err error)

NewError creates an HTTPError instance and returns it.

func OptionsGet

func OptionsGet(c *gin.Context)

func OptionsGetPatchDelete

func OptionsGetPatchDelete(c *gin.Context)

func OptionsGetPost

func OptionsGetPost(c *gin.Context)

func ParseID

func ParseID(c *gin.Context, param string) (uint64, error)

ParseID parses the ID.

func RequestHost

func RequestHost(c *gin.Context) string

The scheme defaults to https and only falls back to http if the x-forwarded-proto header is set to "http".

func RequestPathV1

func RequestPathV1(c *gin.Context) string

RequestPathV1 returns the URL with the prefix for API v1.

func RequestURL

func RequestURL(c *gin.Context) string

RequestURL returns the full request URL.

Types

type HTTPError

type HTTPError struct {
	Error string `json:"error" example:"An ID specified in the query string was not a valid uint64"`
}

HTTPError is used for error responses that contain a body.

Jump to

Keyboard shortcuts

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