serverx

package
v0.0.49 Latest Latest
Warning

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

Go to latest
Published: Apr 17, 2019 License: Apache-2.0 Imports: 5 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNotFoundHandler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
	w.WriteHeader(http.StatusNotFound)

	if r.Header.Get("Content-type") == "application/json" {
		_, _ = w.Write([]byte(`{"error": "The requested route does not exist"}`))
		return
	}

	_, _ = w.Write([]byte(`The request route does not exist`))
})

DefaultNotFoundHandler is a default handler for handling 404 errors.

Functions

func ErrorEnhancerRFC6749

func ErrorEnhancerRFC6749(r *http.Request, err error) interface{}

ErrorEnhancerRFC6749 returns an error of type fosite.ErrorEnhancerRFC6749

func PermanentRedirect added in v0.0.11

func PermanentRedirect(to string) func(rw http.ResponseWriter, r *http.Request, _ httprouter.Params)

PermanentRedirect permanently redirects (302) a path to another one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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