httputil

package
v0.5.7 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package httputil provides HTTP utilities for LocalGo

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RespondError

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

RespondError sends an error response

func RespondJSON

func RespondJSON(w http.ResponseWriter, statusCode int, data interface{})

RespondJSON sends a JSON response. The data is marshalled before any headers are written so that a marshal failure can still produce a proper 500 response.

func RespondOK

func RespondOK(w http.ResponseWriter)

RespondOK sends an OK response with no content

func SetLogger added in v0.3.6

func SetLogger(l *zap.SugaredLogger)

SetLogger configures the package-level logger used by httputil helpers. Call this once at server startup with the same logger used by handlers.

Types

type Error

type Error struct {
	Error string `json:"error"`
}

Error represents an error response

Jump to

Keyboard shortcuts

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