http

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 22, 2023 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Bind

func Bind[TIn any](s Server, handler func(*gin.Context, TIn) error) gin.HandlerFunc

Bind the request to the given TIn and handle errors if any by setting the appropriate status.

func Created

func Created[TOut any](s Server, ctx *gin.Context, data TOut, location string, args ...any) error

Sets the location header and the response status

func File

func File(ctx *gin.Context, filepath string) error

Returns the file at the given path.

func NoContent

func NoContent(ctx *gin.Context) error

Mark the request has succeeded with no data.

func Ok

func Ok[TOut any](ctx *gin.Context, data TOut) error

Mark the request has succeeded with the given data.

func Send

func Send(s Server, handler func(*gin.Context) error) gin.HandlerFunc

Call the given handler and handle any returned error by setting the appropriate status.

Types

type Server

type Server interface {
	UseSSL() bool
	Logger() log.Logger
}

Tiny interface to represents needed contrat in order to use helpers provided by this package.

Jump to

Keyboard shortcuts

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