response

package
v0.0.0-...-17f76c2 Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LogErrorResponse

func LogErrorResponse(r *http.Request, err error, code int, message string)

LogErrorResponse - logs an errornous server server at level debug on standard logger

func LogSuccessfulResponse

func LogSuccessfulResponse(r *http.Request, data interface{})

LogSuccessfulResponse - logs a successful server response at level debug on standard logger

func WriteErrorJSON

func WriteErrorJSON(w *http.ResponseWriter, r *http.Request, code int, message string)

WriteErrorJSON - logs and sends a json response to the client showing the error message

func WriteSuccessfulJSON

func WriteSuccessfulJSON(w *http.ResponseWriter, r *http.Request, data interface{})

WriteSuccessfulJSON - logs and sends a new json response to the client

Types

type Error

type Error struct {
	Error   bool   `json:"error"`
	Code    int    `json:"statusCode"`
	Message string `json:"message"`
}

Error represents the structure of an error message

Jump to

Keyboard shortcuts

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