Documentation ¶
Overview ¶
Package httpx contains convenience HTTP helper functions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( MethodOverrideHeader = "X-HTTP-Method-Override" MethodOverrideField = "_method" )
View Source
var (
JSONContentType = "application/json"
)
Functions ¶
func BasicAuth ¶
BasicAuth provides safe basic auth handling. See https://www.alexedwards.net/blog/basic-authentication-in-go.
func MethodOverride ¶
The MethodOverride middleware checks for a HTTP method override in the request and uses it instead of the original method.
For security reasons only `POST` can be overridden with `PUT`, `PATCH` or `DELETE`.
MethodOverride is similar to the gorilla HTTPMethodOverrideHandler but checks for a X-HTTP-Method-Override header before the _method form field to avoid parsing the request body unnecessarily.
func RenderJSON ¶
func RenderJSON(w http.ResponseWriter, status int, v any)
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.