httphelper

package
v0.0.0-...-cb90f35 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2022 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQueryParam

func GetQueryParam(r *http.Request, key string) string

func ReadRequest

func ReadRequest(r *http.Request, w http.ResponseWriter, v interface{}) (err error)

ReadRequest Parses the request as JSON into the models parameter Errors are logged and should be handled by returning 500

func WriteErrorResponse

func WriteErrorResponse(r *http.Request, w http.ResponseWriter, errorCode int) error

WriteErrorResponse writes the passed error code to the response is tries also to resolve a error message (not implemented) The status code is set to 400 BadRequest Errors are logged and should be handled by returning 500

func WriteResponse

func WriteResponse(r *http.Request, w http.ResponseWriter, v interface{}) (err error)

WriteResponse marshals the interface to json and throws on error Errors are logged and should be handled by returning 500

Types

This section is empty.

Jump to

Keyboard shortcuts

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