Documentation
¶
Index ¶
- Constants
- Variables
- func JSONError(w http.ResponseWriter, err, details any, jobId string, code int)
- func JSONResponse(w http.ResponseWriter, content any, jobId string, code int)
- func ResolveRequestIP(remoteAddr, trustedProxyHeader string, headers http.Header, ...) string
- func ValidateApiKey(r *http.Request, apiKey string) bool
- type ErrorResponse
- type Response
Constants ¶
View Source
const KeyHeader = "x-api-key" // Header for API key
Variables ¶
Functions ¶
func JSONError ¶ added in v0.115.0
func JSONError(w http.ResponseWriter, err, details any, jobId string, code int)
JSONError writes an error response to the client in JSON format.
func JSONResponse ¶ added in v0.115.0
func JSONResponse(w http.ResponseWriter, content any, jobId string, code int)
JSONResponse writes a successful response in the common JSON envelope.
Types ¶
type ErrorResponse ¶ added in v0.115.0
ErrorResponse inherits from Response and adds an error message.
Click to show internal directories.
Click to hide internal directories.