response

package
v0.0.0-...-8bff5d1 Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EncodedJSON

func EncodedJSON(w http.ResponseWriter, buf []byte)

EncodedJSON writes a response from a buffer with json encoded content.

The status is predefined as 200 (OK).

func Error

func Error(w http.ResponseWriter, status int, err error)

Error is the function used to send error resposes.

func HTMLText

func HTMLText(w http.ResponseWriter, status int, text string)

HTMLText is the function used to send html text resposes.

func JSON

func JSON(w http.ResponseWriter, status int, v interface{})

JSON is the function used to send JSON responses.

func JSONAndCache

func JSONAndCache(mc *memcache.Client, w http.ResponseWriter, key string, v interface{})

JSONAndCache works just like JSON but saves the encoding of v to the cache before writing the response.

The status should always be 200 (OK).

func JSONText

func JSONText(w http.ResponseWriter, status int, message string)

JSONText is the function used to send JSON formatted text responses.

Types

This section is empty.

Jump to

Keyboard shortcuts

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