Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
caddy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
caddy
Commits
05b39385
Commit
05b39385
authored
Jun 19, 2019
by
Matthew Holt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes to tests
parent
62b4553f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
8 deletions
+8
-8
caddyhttp/httpserver/https_test.go
caddyhttp/httpserver/https_test.go
+3
-2
caddyhttp/staticfiles/fileserver_test.go
caddyhttp/staticfiles/fileserver_test.go
+5
-6
No files found.
caddyhttp/httpserver/https_test.go
View file @
05b39385
...
...
@@ -20,6 +20,7 @@ import (
"net"
"net/http"
"net/http/httptest"
"strconv"
"testing"
"github.com/mholt/caddy/caddytls"
...
...
@@ -55,7 +56,7 @@ func TestRedirPlaintextHost(t *testing.T) {
},
{
Host
:
"foohost"
,
Port
:
HTTPSPort
,
// since this is the 'default' HTTPS port, should not be included in Location value
Port
:
strconv
.
Itoa
(
certmagic
.
HTTPSPort
)
,
// since this is the 'default' HTTPS port, should not be included in Location value
},
{
Host
:
"*.example.com"
,
...
...
@@ -83,7 +84,7 @@ func TestRedirPlaintextHost(t *testing.T) {
if
actual
,
expected
:=
cfg
.
ListenHost
,
testcase
.
ListenHost
;
actual
!=
expected
{
t
.
Errorf
(
"Test %d: Expected redir config to have bindhost %s but got %s"
,
i
,
expected
,
actual
)
}
if
actual
,
expected
:=
cfg
.
Addr
.
Port
,
HTTPPort
;
actual
!=
expected
{
if
actual
,
expected
:=
cfg
.
Addr
.
Port
,
strconv
.
Itoa
(
certmagic
.
HTTPPort
)
;
actual
!=
expected
{
t
.
Errorf
(
"Test %d: Expected redir config to have port '%s' but got '%s'"
,
i
,
expected
,
actual
)
}
...
...
caddyhttp/staticfiles/fileserver_test.go
View file @
05b39385
...
...
@@ -432,7 +432,7 @@ func TestServeHTTPFailingFS(t *testing.T) {
fsErr
error
expectedStatus
int
expectedErr
error
expectedHeaders
map
[
string
]
str
ing
expectedHeaders
map
[
string
]
str
uct
{}
}{
{
fsErr
:
os
.
ErrNotExist
,
...
...
@@ -448,7 +448,7 @@ func TestServeHTTPFailingFS(t *testing.T) {
fsErr
:
errCustom
,
expectedStatus
:
http
.
StatusServiceUnavailable
,
expectedErr
:
errCustom
,
expectedHeaders
:
map
[
string
]
str
ing
{
"Retry-After"
:
"5"
},
expectedHeaders
:
map
[
string
]
str
uct
{}{
"Retry-After"
:
{}
},
},
}
...
...
@@ -477,10 +477,9 @@ func TestServeHTTPFailingFS(t *testing.T) {
// check the headers - a special case for server under load
if
test
.
expectedHeaders
!=
nil
&&
len
(
test
.
expectedHeaders
)
>
0
{
for
expectedKey
,
expectedVal
:=
range
test
.
expectedHeaders
{
actualVal
:=
responseRecorder
.
Header
()
.
Get
(
expectedKey
)
if
expectedVal
!=
actualVal
{
t
.
Errorf
(
"Test %d: Expected header %s: %s, found %s"
,
i
,
expectedKey
,
expectedVal
,
actualVal
)
for
expectedKey
:=
range
test
.
expectedHeaders
{
if
_
,
ok
:=
responseRecorder
.
Header
()[
expectedKey
];
!
ok
{
t
.
Errorf
(
"Test %d: Expected header %s, but was missing"
,
i
,
expectedKey
)
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment