responses

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ContentTypeRss application/rss+xml
	ContentTypeRss = "application/rss+xml"
	// ContentTypeAtom application/atom+xml
	ContentTypeAtom = "application/atom+xml"
	// ContentTypeApplicationXML application/xml
	ContentTypeApplicationXML = "application/xml"
)

Variables

This section is empty.

Functions

func ClearCookie

func ClearCookie(ctx *fasthttp.RequestCtx, name string)

ClearCookie removes a cookie from client

func ErrorJSON

func ErrorJSON(ctx *fasthttp.RequestCtx, status int, message string, errors []string) error

ErrorJSON todo descr

func ErrorResponse

func ErrorResponse(ctx *fasthttp.RequestCtx, status int)

ErrorResponse writes to ResponseWriter error with a corresponding template or serialized payload

func NewCookie

func NewCookie(ctx *fasthttp.RequestCtx, cookie *Cookie) *fasthttp.Cookie

NewCookie builds a cookie instance

func SetRootCookie

func SetRootCookie(ctx *fasthttp.RequestCtx, name, value string, ttl time.Duration)

SetRootCookie sets prebuilt cookie to response headers

func SuccessHTML added in v0.0.20

func SuccessHTML(ctx *fasthttp.RequestCtx, data interface{})

SuccessHTML writes []byte data to ResponseWriter setting status 200 and content type

func SuccessJSON

func SuccessJSON(ctx *fasthttp.RequestCtx, status int, message string, data interface{}, count int, offset int) error

SuccessJSON todo descr

func SuccessXML added in v0.0.20

func SuccessXML(ctx *fasthttp.RequestCtx, contentType string, data interface{})

SuccessXML writes []byte data to ResponseWriter setting status 200 and content type

Types

type Cookie struct {
	Name     string
	Value    string
	Path     string
	Expires  time.Time
	IsSecure bool
}

Cookie simple cookie type

Jump to

Keyboard shortcuts

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