package
0.2.21
Repository: https://github.com/plainq/servekit.git
Documentation: pkg.go.dev

# Functions

ErrorGRPC tries to map err to errkit.Error and based on result writes standard gRPC error with status statusCode to the response writer.
ErrorHTTP tries to map err to errkit.Error and based on result writes standard HTTP error with status statusCode to the response writer.
HTML tries to encode v into json representation and write it to response writer.
JSON tries to encode v into json representation and write it to response writer.
Options returns a pointer to a new ResponseOptions object with default values and applies the given options to it.
SetGRPCErrorResponder sets the given responder as errGRPCResponder.
SetHTMLTemplateProvider sets the given htmlTemplater as htmlTemplater.
SetHTTPErrorResponder sets the given responder as errHTTPResponder.
Status writes an HTTP status to the w http.ResponseWriter.
TemplateHTML generates an HTML template response for the given name and data.
TEXT tries to write v to response writer.
WithErrorReport is an Option function that will enable error reporting by the errkit.ErrorReporter.
WithHeader is an Option function that adds the given key-value pair to the headers of the ResponseOptions.
WithStatus sets the given status code as the statusCode field of the ResponseOptions parameter.

# Structs

ResponseOptions represents the options for an HTTP response.

# Interfaces

HTMLTemplateProvider wraps a Template method to render requested HTML template.

# Type aliases

GRPCErrorResponder represents a function type that handles and responds to GRPC errors.
HTTPErrorResponder represents a function which should be called to respond with an error on HTTP call.
Option represents a function type that modifies ResponseOptions for an HTTP response.