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
387a0832
Commit
387a0832
authored
Jul 08, 2017
by
spacewander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gzip,mime: show response header instead of the request one in test message
parent
a6ec51b3
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
3 deletions
+3
-3
caddyhttp/gzip/gzip_test.go
caddyhttp/gzip/gzip_test.go
+2
-2
caddyhttp/mime/mime_test.go
caddyhttp/mime/mime_test.go
+1
-1
No files found.
caddyhttp/gzip/gzip_test.go
View file @
387a0832
...
...
@@ -109,10 +109,10 @@ func nextFunc(shouldGzip bool) httpserver.Handler {
if
shouldGzip
{
if
w
.
Header
()
.
Get
(
"Content-Encoding"
)
!=
"gzip"
{
return
0
,
fmt
.
Errorf
(
"Content-Encoding must be gzip, found %v"
,
r
.
Header
.
Get
(
"Content-Encoding"
))
return
0
,
fmt
.
Errorf
(
"Content-Encoding must be gzip, found %v"
,
w
.
Header
()
.
Get
(
"Content-Encoding"
))
}
if
w
.
Header
()
.
Get
(
"Vary"
)
!=
"Accept-Encoding"
{
return
0
,
fmt
.
Errorf
(
"Vary must be Accept-Encoding, found %v"
,
r
.
Header
.
Get
(
"Vary"
))
return
0
,
fmt
.
Errorf
(
"Vary must be Accept-Encoding, found %v"
,
w
.
Header
()
.
Get
(
"Vary"
))
}
if
_
,
ok
:=
w
.
(
*
gzipResponseWriter
);
!
ok
{
return
0
,
fmt
.
Errorf
(
"ResponseWriter should be gzipResponseWriter, found %T"
,
w
)
...
...
caddyhttp/mime/mime_test.go
View file @
387a0832
...
...
@@ -57,7 +57,7 @@ func nextFunc(shouldMime bool, contentType string) httpserver.Handler {
return
httpserver
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
(
int
,
error
)
{
if
shouldMime
{
if
w
.
Header
()
.
Get
(
"Content-Type"
)
!=
contentType
{
return
0
,
fmt
.
Errorf
(
"expected Content-Type: %v, found %v"
,
contentType
,
r
.
Header
.
Get
(
"Content-Type"
))
return
0
,
fmt
.
Errorf
(
"expected Content-Type: %v, found %v"
,
contentType
,
w
.
Header
()
.
Get
(
"Content-Type"
))
}
return
0
,
nil
}
...
...
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