From abef8926bbf09aff01a298b240e1f1517fd349e8 Mon Sep 17 00:00:00 2001 From: dinh-tran Date: Wed, 6 Dec 2017 15:01:42 +0700 Subject: [PATCH 1/2] Add public get functions for basicAuth, basicAuthUser, basicAuthPassword --- app.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app.go b/app.go index f9e9a69..63490b4 100644 --- a/app.go +++ b/app.go @@ -111,6 +111,21 @@ func (app *App) SetBasicAuth(user, password string) { app.basicAuthPassword = password } +// IsBasicAuth indicate authentication is basic or not +func (app *App) IsBasicAuth() bool { + return app.basicAuth +} + +// GetBasicAuthUser return username string for basic authentication +func (app *App) GetBasicAuthUser() string { + return app.basicAuthUser +} + +// GetBasicAuthPassword return password string for basic authentication +func (app *App) GetBasicAuthPassword() string { + return app.basicAuthPassword +} + func (app *App) newRequest(method, api string, body io.Reader) (*http.Request, error) { if len(app.token) == 0 { app.token = base64.StdEncoding.EncodeToString( From e008df949eeda39c54344004a4f005471e6c2ae8 Mon Sep 17 00:00:00 2001 From: dinh-tran Date: Wed, 6 Dec 2017 15:30:22 +0700 Subject: [PATCH 2/2] Change IsBasicAuth to HasBasicAuth --- app.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app.go b/app.go index 63490b4..36d4032 100644 --- a/app.go +++ b/app.go @@ -111,8 +111,8 @@ func (app *App) SetBasicAuth(user, password string) { app.basicAuthPassword = password } -// IsBasicAuth indicate authentication is basic or not -func (app *App) IsBasicAuth() bool { +// HasBasicAuth indicate authentication is basic or not +func (app *App) HasBasicAuth() bool { return app.basicAuth }