http

package
v0.5.12 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeJSONBody

func DecodeJSONBody(w http.ResponseWriter, r *http.Request, dst interface{}) errors.ErouskaError

DecodeJSONBody Decode request body from JSON to struct copied from https://www.alexedwards.net/blog/how-to-properly-parse-a-json-request-body

func DecodeJSONOrReportError

func DecodeJSONOrReportError(w http.ResponseWriter, r *http.Request, dst interface{}) bool

DecodeJSONOrReportError Decodes request JSON and writes possible errors to the ResponseWriter. Return bool - if the request was decoded successfully.

func NewThrottlingAwareClient added in v0.5.0

func NewThrottlingAwareClient(httpClient *http.Client, requestLogger func(format string, args ...interface{})) *http.Client

NewThrottlingAwareClient Wraps given client and handles retries on HTTP 429.

func SendEmptyResponse

func SendEmptyResponse(w http.ResponseWriter, r *http.Request)

SendEmptyResponse Marshals empty response into JSON and sends it to the client.

func SendErrorResponse

func SendErrorResponse(w http.ResponseWriter, r *http.Request, err error)

SendErrorResponse Sends error response as required by Firebase SDK.

func SendResponse

func SendResponse(w http.ResponseWriter, r *http.Request, response interface{})

SendResponse Marshals response into JSON and sends it to the client.

Types

This section is empty.

Jump to

Keyboard shortcuts

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