httputils

package module
v0.0.0-...-d908b39 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2016 License: BSD-2-Clause Imports: 6 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

README

httputils

Misc Golang HTTP Utilities

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Error

func Error(w http.ResponseWriter, code int, msg string, logErr error)

func InternalServerError

func InternalServerError(w http.ResponseWriter, msg string, logErr error)

The following functions are shorthand for creating and emitting the error all at once

func RequestAcceptsJSON

func RequestAcceptsJSON(r *http.Request) error

Types

type HttpError

type HttpError struct {
	Skip int // callstack frames to skip for debug tracking

	Errs binding.Errors

	Msg  string
	Code int

	LogMsg string
}

func NewHttpError

func NewHttpError() *HttpError

HttpError represents both the error to send to the user and the error to log.

func (*HttpError) Error

func (herr *HttpError) Error(code int, msg string, logErr error)

func (*HttpError) Errors

func (herr *HttpError) Errors(errs binding.Errors)

func (*HttpError) InternalServerError

func (herr *HttpError) InternalServerError(msg string, logErr error)

func (*HttpError) OK

func (herr *HttpError) OK() bool

func (*HttpError) Write

func (herr *HttpError) Write(w http.ResponseWriter)

Jump to

Keyboard shortcuts

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