Create Header Middleware
This commit is contained in:
parent
aea7bc0c07
commit
f275e4ad3c
12 changed files with 592 additions and 3 deletions
37
types/types_test.go
Normal file
37
types/types_test.go
Normal file
|
@ -0,0 +1,37 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestHeaders_ShouldReturnFalseWhenNotHasCustomHeadersDefined(t *testing.T) {
|
||||
headers := Headers{}
|
||||
|
||||
assert.False(t, headers.HasCustomHeadersDefined())
|
||||
}
|
||||
|
||||
func TestHeaders_ShouldReturnTrueWhenHasCustomHeadersDefined(t *testing.T) {
|
||||
headers := Headers{}
|
||||
|
||||
headers.CustomRequestHeaders = map[string]string{
|
||||
"foo": "bar",
|
||||
}
|
||||
|
||||
assert.True(t, headers.HasCustomHeadersDefined())
|
||||
}
|
||||
|
||||
func TestHeaders_ShouldReturnFalseWhenNotHasSecureHeadersDefined(t *testing.T) {
|
||||
headers := Headers{}
|
||||
|
||||
assert.False(t, headers.HasSecureHeadersDefined())
|
||||
}
|
||||
|
||||
func TestHeaders_ShouldReturnTrueWhenHasSecureHeadersDefined(t *testing.T) {
|
||||
headers := Headers{}
|
||||
|
||||
headers.SSLRedirect = true
|
||||
|
||||
assert.True(t, headers.HasSecureHeadersDefined())
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue