common

package
v0.4.9 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package common provides shared HTTP utility functions for API handlers.

Package common provides shared HTTP utility functions for API handlers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAndValidateServerNameParam added in v0.3.7

func GetAndValidateServerNameParam(r *http.Request, paramName string) (string, error)

GetAndValidateServerNameParam extracts and validates a server name from URL params. Validates reverse-DNS format: namespace/name

func GetAndValidateURLParam added in v0.3.3

func GetAndValidateURLParam(r *http.Request, paramName string) (string, error)

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.

Jump to

Keyboard shortcuts

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