response

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func JSON

func JSON(w http.ResponseWriter, statusCode int, obj any) error

func NoContent

func NoContent(w http.ResponseWriter) error

func Range

func Range(w http.ResponseWriter, statusCode int, contentType string, r io.ReadSeeker) error

func RawData

func RawData(w http.ResponseWriter, statusCode int, contentType string, body []byte) error

func Redirect added in v0.1.7

func Redirect(w http.ResponseWriter, r *http.Request, status int, url string) error

func Stream

func Stream(w http.ResponseWriter, statusCode int, contentType string, r io.Reader) error

func Text

func Text(w http.ResponseWriter, statusCode int, msg string) error

Types

type APIError

type APIError struct {
	Status int
	Text   string
}

func NewAPIError

func NewAPIError(statusCode int) APIError

func (APIError) Error

func (e APIError) Error() string

type H

type H map[string]any

Jump to

Keyboard shortcuts

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