Documentation
¶
Overview ¶
Package common provides shared HTTP utility functions for API handlers.
Package common provides shared HTTP utility functions for API handlers.
Index ¶
- func GetAndValidateServerNameParam(r *http.Request, paramName string) (string, error)
- func GetAndValidateURLParam(r *http.Request, paramName string) (string, error)
- func WriteErrorResponse(w http.ResponseWriter, message string, statusCode int)
- func WriteJSONResponse(w http.ResponseWriter, data interface{}, statusCode int)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAndValidateServerNameParam ¶ added in v0.3.7
GetAndValidateServerNameParam extracts and validates a server name from URL params. Validates reverse-DNS format: namespace/name
func GetAndValidateURLParam ¶ added in v0.3.3
GetAndValidateURLParam extracts, decodes, and validates a URL parameter from the request. Returns the decoded value or an error if invalid. Validation rules: - Must not be empty after trimming whitespace - Must not contain any whitespace characters
func WriteErrorResponse ¶
func WriteErrorResponse(w http.ResponseWriter, message string, statusCode int)
WriteErrorResponse writes a standardized error response
func WriteJSONResponse ¶
func WriteJSONResponse(w http.ResponseWriter, data interface{}, statusCode int)
WriteJSONResponse writes a JSON response with the given data
Types ¶
This section is empty.