httputil

package
v1.0.1-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2023 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MethodGET = "GET"
)

Common HTTP methods and header values.

Variables

This section is empty.

Functions

func RespondWithJSON

func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})

RespondWithJSON provides an auxiliary function to return an HTTP response with JSON content and an HTTP status code.

Types

type ErrResponse

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

ErrResponse defines an HTTP error response.

Jump to

Keyboard shortcuts

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