responsewriters

package
v1.6.5 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2017 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package responsewriters containers helpers to write responses in HTTP handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BadGatewayError

func BadGatewayError(w http.ResponseWriter, req *http.Request)

BadGatewayError renders a simple bad gateway error.

func ErrorNegotiated

ErrorNegotiated renders an error to the response. Returns the HTTP status code of the error.

func Forbidden

func Forbidden(attributes authorizer.Attributes, w http.ResponseWriter, req *http.Request, reason string)

Forbidden renders a simple forbidden error

func InternalError

func InternalError(w http.ResponseWriter, req *http.Request, err error)

InternalError renders a simple internal error

func NotFound

func NotFound(w http.ResponseWriter, req *http.Request)

NotFound renders a simple not found error.

func WriteObject

func WriteObject(statusCode int, gv schema.GroupVersion, s runtime.NegotiatedSerializer, object runtime.Object, w http.ResponseWriter, req *http.Request)

WriteObject renders a returned runtime.Object to the response as a stream or an encoded object. If the object returned by the response implements rest.ResourceStreamer that interface will be used to render the response. The Accept header and current API version will be passed in, and the output will be copied directly to the response body. If content type is returned it is used, otherwise the content type will be "application/octet-stream". All other objects are sent to standard JSON serialization.

func WriteObjectNegotiated

func WriteObjectNegotiated(s runtime.NegotiatedSerializer, gv schema.GroupVersion, w http.ResponseWriter, req *http.Request, statusCode int, object runtime.Object)

WriteObjectNegotiated renders an object in the content type negotiated by the client

func WriteRawJSON

func WriteRawJSON(statusCode int, object interface{}, w http.ResponseWriter)

WriteRawJSON writes a non-API object in JSON.

Types

This section is empty.

Jump to

Keyboard shortcuts

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