render

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContentJSON

func ContentJSON(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter, body []byte)

ContentJSON writes JSON bytes to the response writer with status code OK

func Created

func Created(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter, location string)

Created writes location header to response writer with status code Created

func ErrorOrStatus

func ErrorOrStatus(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter, err error)

ErrorOrStatus wraps Status if error is a Status, otherwise writes status code Internal Server Error

func Health

func Health(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter, serviceName string)

ContentJSON writes a small JSON body to the response writer with status code OK

Used for health check endpoints to ensure API is serving

func NoContent

func NoContent(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter)

NoContent writes status code No Content

func Status

func Status(ctx context.Context, headersClient go_headers.Client, logClient go_log.Client, w http.ResponseWriter, s go_errors.Status)

Status writes a go_errors.Status as JSON to the response writer with status code Status.Code

Types

This section is empty.

Jump to

Keyboard shortcuts

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