Implement GetHost()

This commit is contained in:
DataHoarder 2022-06-07 01:08:57 +02:00
parent 4821aa05b5
commit 517eb1652a
Signed by: DataHoarder
SSH key fingerprint: SHA256:OLTRf6Fl87G52SiR7sWLGNzlJt4WOX+tfI2yxo0z7xk
3 changed files with 9 additions and 0 deletions

View file

@ -65,6 +65,10 @@ func (c *FastHTTPContext) GetTLSServerName() string {
return c.ctx.TLSConnectionState().ServerName
}
func (c *FastHTTPContext) GetHost() string {
return string(c.ctx.Request.Host())
}
func (c *FastHTTPContext) GetRequestHeader(name string) string {
return string(c.ctx.Request.Header.Peek(name))
}

View file

@ -65,6 +65,10 @@ func (c *NetHTTPContext) GetTLSServerName() string {
return c.httpRequest.TLS.ServerName
}
func (c *NetHTTPContext) GetHost() string {
return c.httpRequest.Host
}
func (c *NetHTTPContext) GetRequestHeader(name string) string {
return c.httpRequest.Header.Get(name)

View file

@ -39,6 +39,7 @@ type RequestContext interface {
GetRequestTime() time.Time
GetTLSServerName() string
GetBody() io.Reader
GetHost() string
GetRequestHeader(name string) string
GetResponseHeader(name string) string
AddResponseHeader(name string, value string)