Documentation ¶
Overview ¶
Package response provides helper functions and structs to respond to API requests.
Index ¶
- func WriteInternalErrorProblemDetails(w http.ResponseWriter, logger *slog.Logger)
- func WriteJSON(w http.ResponseWriter, data any, logger *slog.Logger)
- func WriteProblemDetails(w http.ResponseWriter, problemDetails ProblemDetails, logger *slog.Logger)
- func WriteRequestBodyInvalidProblemDetails(w http.ResponseWriter, err error, logger *slog.Logger)
- type ProblemDetails
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WriteInternalErrorProblemDetails ¶
func WriteInternalErrorProblemDetails(w http.ResponseWriter, logger *slog.Logger)
func WriteProblemDetails ¶
func WriteProblemDetails(w http.ResponseWriter, problemDetails ProblemDetails, logger *slog.Logger)
func WriteRequestBodyInvalidProblemDetails ¶
func WriteRequestBodyInvalidProblemDetails(w http.ResponseWriter, err error, logger *slog.Logger)
Types ¶
type ProblemDetails ¶
type ProblemDetails struct { Type string `json:"type,omitempty"` Status int `json:"status,omitempty"` Title string `json:"title,omitempty"` Detail string `json:"detail,omitempty"` }
func NewProblemDetails ¶
func NewProblemDetails(problemDetailsType string, status int, title string, detail string) ProblemDetails
Click to show internal directories.
Click to hide internal directories.