response

package
v0.0.2-alpha Latest Latest
Warning

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

Go to latest
Published: May 4, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package response provides utilities for writing HTTP responses in the Zero server. It includes functions for writing JSON responses, error responses, and setting response headers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func InternalServerError

func InternalServerError(w http.ResponseWriter, err error)

InternalServerError writes a generic 500 response to the client and logs the real error server-side

func SetHeader

func SetHeader(w http.ResponseWriter, key, value string)

SetHeader sets a response header with the given key and value

func StatusCode

func StatusCode(w http.ResponseWriter) int

func Write

func Write(w http.ResponseWriter, contentType string, statusCode int, data []byte)

Write writes a response with the given content type, status code, and data

func WriteError

func WriteError(w http.ResponseWriter, statusCode int, err error)

WriteError writes an error response with the given status code and error

func WriteErrorMsg

func WriteErrorMsg(w http.ResponseWriter, statusCode int, message string)

WriteErrorMsg writes an error response with the given status code and message

func WriteJSON

func WriteJSON(w http.ResponseWriter, statusCode int, data any)

WriteJSON writes a JSON response with the given status code and data

Types

This section is empty.

Jump to

Keyboard shortcuts

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