http

package
v0.0.0-...-d56ccab Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNotFound = &HttpResponse{HTTPStatusCode: 404, StatusText: "Resource not found."}

Functions

func ErrBadRequest

func ErrBadRequest(err error) render.Renderer

func ErrRender

func ErrRender(err error) render.Renderer

func ErrServerInternal

func ErrServerInternal(err error) render.Renderer

func ErrUnauthorized

func ErrUnauthorized(err error) render.Renderer

func TextOkRender

func TextOkRender(message string) render.Renderer

Types

type HttpResponse

type HttpResponse struct {
	Err            error  `json:"-"`               // low-level runtime error
	HTTPStatusCode int    `json:"-"`               // http response status code
	StatusText     string `json:"status"`          // user-level status message
	AppCode        int64  `json:"code,omitempty"`  // application-specific error code
	ErrorText      string `json:"error,omitempty"` // application-level error message, for debugging
}

func (*HttpResponse) Render

func (e *HttpResponse) Render(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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