refactor: using requestHeader internal func (#1083)

* refactor: using requestHeader internal func.

* update

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2017-08-26 05:02:47 -05:00 committed by Javier Provecho Fernandez
parent fa391a4864
commit 211c48f040
2 changed files with 2 additions and 2 deletions

View File

@ -47,7 +47,7 @@ func BasicAuthForRealm(accounts Accounts, realm string) HandlerFunc {
pairs := processAccounts(accounts)
return func(c *Context) {
// Search user in the slice of allowed credentials
user, found := pairs.searchCredential(c.Request.Header.Get("Authorization"))
user, found := pairs.searchCredential(c.requestHeader("Authorization"))
if !found {
// Credentials doesn't match, we return 401 and abort handlers chain.
c.Header("WWW-Authenticate", realm)

View File

@ -509,7 +509,7 @@ func (c *Context) ClientIP() string {
}
if c.engine.AppEngine {
if addr := c.Request.Header.Get("X-Appengine-Remote-Addr"); addr != "" {
if addr := c.requestHeader("X-Appengine-Remote-Addr"); addr != "" {
return addr
}
}