response

package
v0.0.22 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Write added in v0.0.17

func Write(w http.ResponseWriter, opts ...Option) error

Write sends the response to the client. The `response` fields can be overridden by passing variadic `opts` ("Functional Options") arguments. If no options are given, an empty `200` response is used.

Types

type Option added in v0.0.16

type Option func(*response)

Option helps overriding/adding response options to the current response.

func Code added in v0.0.16

func Code(code int) Option

Code sets status code.

func Error

func Error(action string, message string, errors map[string]string) Option

Error represents "failure" response.

func Headers added in v0.0.16

func Headers(headers map[string]string) Option

Headers adds headers.

func Success

func Success(action string, data interface{}, meta interface{}) Option

Success represents "successful" response.

Jump to

Keyboard shortcuts

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