chttp

package
v0.0.0-...-36eb6dd Latest Latest
Warning

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

Go to latest
Published: Mar 8, 2025 License: MPL-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func QueryParam

func QueryParam(r *http.Request, param string) string

func Send

func Send(w http.ResponseWriter, data any, err error)

Send writes given `data` or `err` to `w` as `json`

func SendAsAttachment

func SendAsAttachment(w http.ResponseWriter, r *http.Request, filename string, data io.ReadSeeker, err error)

SendAsAttachment attaches given `data` as downloadable attachment with given `filename` it supports ranged requests

Types

type Response

type Response struct {
	Data  any
	Error string `json:",omitempty"`
}

Jump to

Keyboard shortcuts

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