response

package
v1.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseBody

func ParseBody(body io.ReadCloser, parameters interface{}) error

ParseBody reads the raw body data and parses it into the parameters reference

Types

type Response

type Response struct {
	Payload chttp.Payload
	Writer  http.ResponseWriter
}

func (*Response) Error

func (response *Response) Error(statusCode int)

Error just like Send it writes the error to the response

func (*Response) Json

func (response *Response) Json() *Response

Json Marks a response as a json response

func (*Response) Send

func (response *Response) Send(statusCode int)

Send writes the data to the response

func (*Response) SetError

func (response *Response) SetError(code int, message string) *Response

SetError sets the error code and message. It is used before calling Error(statusCode)

func (*Response) SetPayload

func (response *Response) SetPayload(data any) *Response

SetPayload updates the response.Payload with any data

Jump to

Keyboard shortcuts

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