Package: req
Helpers for reading values out of http.Request: query and form parameters,
trimmed string getters, and client IP detection. Used throughout the controllers to keep
parameter handling consistent.
Repository: https://github.com/dracory/req
Installation
go get github.com/dracory/req
Usage
func Handler(w http.ResponseWriter, r *http.Request) {
theme := req.GetStringTrimmed(r, "theme")
ip := req.GetIP(r)
_ = theme
_ = ip
}
Features
GetString/GetStringTrimmed/GetIntfor query & form values.- Client IP extraction honoring proxy headers.
- Small, dependency-free — the de-facto way handlers read request input in this project.