helper

package
v0.0.0-...-99e5d07 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const BADLY_FORMATTED_JSON string = "Request body contains badly-formed JSON"
View Source
const MAX_REQUEST_READ_SIZE int64 = 1048576
View Source
const REQUEST_BODY_MUST_NOT_BE_EMPTY string = "Request body must not be empty"
View Source
const RESPONSE_BODY_MUST_NOT_BE_LARGER_THAN_1MB string = "Request body must not be larger than 1MB"

Variables

This section is empty.

Functions

func DecodeJSONBody

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

DecodeJSONBody decodes a request body in json form and returns a malformed request error type if any errors do occur

func ExtractIDFromRequest

func ExtractIDFromRequest(r *http.Request) (uint32, error)

ExtractIdFromRequest takes as input a request object and extracts an id from it

func ProcessMalformedRequest

func ProcessMalformedRequest(w http.ResponseWriter, err error)

ProcessMalformedRequest handles aggregated errors occurring from interactions with various external services

Types

type JwtCustomClaims

type JwtCustomClaims struct {
	Id string `json:"id"`
	jwt.StandardClaims
}

type MalformedRequest

type MalformedRequest struct {
	Status int
	Msg    string
}

MalformedRequest is a custom error type

func (*MalformedRequest) Error

func (mr *MalformedRequest) Error() string

type TokenValidationResponse

type TokenValidationResponse struct {
	Id        string    `json:"id"`
	ExpiresAt time.Time `json:"expires_at"`
}

Jump to

Keyboard shortcuts

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