respond

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func With

func With(w http.ResponseWriter, r *http.Request, code int, data interface{})

With serialize the data with matching requested encoding

func WithError

func WithError(w http.ResponseWriter, r *http.Request, code int, err interface{})

WithError serialize an error

Types

type Resource

type Resource struct {
	Context string `json:"@context,omitempty"`
	Type    string `json:"@type,omitempty"`
	ID      string `json:"@id,omitempty"`
}

Resource describes a JSON-LD resource header

type Status

type Status struct {
	*Resource `json:",inline"`
	Code      int    `json:"code"`
	Message   string `json:"message"`
}

Status describe a resource to represent an operational status

Jump to

Keyboard shortcuts

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