web

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package web provides utilities for constructing HTTP responses.

Index

Constants

View Source
const (
	ContentTypeApplicationJSON = "application/json"
)

Variables

This section is empty.

Functions

func ContentType

func ContentType(w http.ResponseWriter, ct string)

ContentType sets the Content-Type header.

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

Header sets a header key to a single value.

func JSON

func JSON(w http.ResponseWriter, body any)

JSON writes the JSON representation of the provided data to a response.

func NewInt

func NewInt(s string) int64

NewInt converts a string to an int64 and is primarily used for parsing incoming form values.

func NewString

func NewString(s string) string

NewString sanitizes its input and returns the result. This is primarily used for parsing incoming form values.

func StatusCode

func StatusCode(w http.ResponseWriter, code int)

StatusCode sets the HTTP status code.

Types

This section is empty.

Jump to

Keyboard shortcuts

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