encoding

package
v0.0.0-...-4a5e41d Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2023 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplyJSON

func ReplyJSON(w http.ResponseWriter, r *http.Request, statusCode int, reply interface{})

Types

type BadHTTPRequest

type BadHTTPRequest struct {
	Status int    // HTTP error reason code
	Msg    string // Description what is wrong
}

BadHTTPRequest represents an invalid HTTP request.

func DecodeHTTPJSONBody

func DecodeHTTPJSONBody(w http.ResponseWriter, r *http.Request, to interface{}) *BadHTTPRequest

DecodeHTTPJSONBody JSON decodes the request body into `to`. In case of problems an error is returned. It only accepts request payloads that are smaller than 1MB.

func (*BadHTTPRequest) Error

func (mr *BadHTTPRequest) Error() string

Error returns a brief description what was wrong with the request.

Jump to

Keyboard shortcuts

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