utils

package
v0.0.0-...-87fb0b3 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondError

func RespondError(w http.ResponseWriter, code int, msg string) error

RespondError responds to a HTTP request with body of ErrorResponse

func RespondJSON

func RespondJSON(w http.ResponseWriter, data interface{}) error

RespondJSON responds with arbitrary data objects

Types

type ErrorResponse

type ErrorResponse struct {
	Message string `json:"message"`
}

ErrorResponse is a common struct for responding error for HTTP requests

Jump to

Keyboard shortcuts

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