Categorygithub.com/databus23/requestutil
modulepackage
0.0.0-20180216122111-92f82b6a311e
Repository: https://github.com/databus23/requestutil.git
Documentation: pkg.go.dev

# README

Build Status

requestutil

Requestutil is a small go library for extracting host, port and scheme information from a http.Request. It is usefully for generating absolute urls and considers headers set by loadbalancers (e.g. X-Forwarded-Host ...)

It is inspired by ActionDispatch::Http::URL

# Functions

BaseURL returns Scheme + HostWithPort.
Host returns just the host part of HostWithPort.
HostWithPort returns the HTTP Host: header used by the requesting client.
Port returns the port used by the originating client.
Scheme returns the protocol (http or https) used by the requesting client.