mirror of
https://github.com/openfaas/faas.git
synced 2025-06-09 00:36:46 +00:00
Fixes a problem where basic auth was disabled and a nill pointer was hit, causing a panic. Signed-off-by: Alex Ellis <alexellis2@gmail.com>
22 lines
531 B
Go
22 lines
531 B
Go
// Copyright (c) OpenFaaS Author(s). All rights reserved.
|
|
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
|
|
|
|
package handlers
|
|
|
|
import (
|
|
"net/http"
|
|
"net/http/httptest"
|
|
"testing"
|
|
)
|
|
|
|
func Test_Inject_WithNilRequestAndNilCredentials(t *testing.T) {
|
|
injector := BasicAuthInjector{}
|
|
injector.Inject(nil)
|
|
}
|
|
|
|
func Test_Inject_WithRequestButNilCredentials(t *testing.T) {
|
|
injector := BasicAuthInjector{}
|
|
req := httptest.NewRequest(http.MethodGet, "/", nil)
|
|
injector.Inject(req)
|
|
}
|