respond

package
v0.0.11 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSONData

func WriteJSONData(w http.ResponseWriter, statusCode int, data interface{}) error

WriteJSONData writes the given data to the client as a JSON response.

func WriteJSONMessage

func WriteJSONMessage(w http.ResponseWriter, r *http.Request, statusCode int, message string)

WriteJSONMessage writes a success log and response to the client with the given status code and message.

Types

type HTTPMessage

type HTTPMessage struct {
	Timestamp  time.Time `json:"timestamp"`
	StatusCode int       `json:"status_code"`
	Message    string    `json:"message"`
	Method     string    `json:"method"`
	Path       string    `json:"path"`
}

func (*HTTPMessage) Error

func (e *HTTPMessage) Error() string

func (*HTTPMessage) String

func (e *HTTPMessage) String() string

Jump to

Keyboard shortcuts

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