response

package
v0.9.4 Latest Latest
Warning

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

Go to latest
Published: Jun 15, 2019 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type HTTP

type HTTP struct {
	StatusCode int
	Type       Type
	TextData   string
	JSONData   interface{}
}

HTTP is the web server response.

func Asset added in v0.9.0

func Asset(name string) HTTP

Asset return an asset response (css files, js files, images, etc.).

func JSON

func JSON(data interface{}) HTTP

JSON returns a HTTP response with the JSON headers.

func JSONWithCode added in v0.7.0

func JSONWithCode(data interface{}, code int) HTTP

JSONWithCode is a JSON response with additional status code.

func Static added in v0.2.1

func Static(name string) HTTP

Static return a View response without templating data.

func StaticWithCode added in v0.7.0

func StaticWithCode(name string, code int) HTTP

StaticWithCode is a Static response with additional status code.

func Text

func Text(text string) HTTP

Text returns a HTTP response with plain text.

func TextWithCode added in v0.7.0

func TextWithCode(text string, code int) HTTP

TextWithCode is a Text response with additional status code.

func View

func View(name string, data interface{}) HTTP

View return a View response with templating data.

func ViewWithCode added in v0.7.0

func ViewWithCode(name string, data interface{}, code int) HTTP

ViewWithCode is a View response with additional code.

func (*HTTP) Handle

func (response *HTTP) Handle(req *request.HTTP)

Handle handles the HTTP request using a response writter.

type Type

type Type uint

Type is the name of the response type.

const (
	TextResponse Type = iota
	JSONResponse
	StaticResponse
	AssetResponse
	ViewResponse
)

Indicate the available response types.

Jump to

Keyboard shortcuts

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