httputils

package
v1.14.0-rc.2 Latest Latest
Warning

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

Go to latest
Published: Jun 27, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RequestURI

func RequestURI(r *http.Request) string

RequestURI returns the path and query string (if present) from the request For example: `/foo` or `/foo?hello=world`

func RespondWithError

func RespondWithError(w http.ResponseWriter, statusCode int)

RespondWithError responds to a http.ResponseWriter with an error status code. The text corresponding to the status code is sent as body of the response. This method should be invoked before calling w.WriteHeader, and callers should abort the request after calling this method.

func RespondWithErrorAndMessage

func RespondWithErrorAndMessage(w http.ResponseWriter, statusCode int, message string)

RespondWithErrorAndMessage responds to a http.ResponseWriter with an error status code. The message is included in the body as response. This method should be invoked before calling w.WriteHeader, and callers should abort the request after calling this method.

func RespondWithRedirect

func RespondWithRedirect(w http.ResponseWriter, statusCode int, location string)

RespondWithRedirect responds to a http.ResponseWriter with a redirect. This method should be invoked before calling w.WriteHeader, and callers should abort the request after calling this method.

func SetRequestURI

func SetRequestURI(r *http.Request, uri string) error

SetRequestURI replaces the path and query string (if present) from the request with the input. For example: `/foo` or `/foo?hello=world`

Types

This section is empty.

Jump to

Keyboard shortcuts

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