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
Łukasz Nowak
caddy
Commits
9e97d79c
Commit
9e97d79c
authored
Jun 08, 2015
by
Zac Bergquist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Ensure that proper names are capitalized in error strings.
parent
41e1f1ff
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
middleware/gzip/gzip_test.go
middleware/gzip/gzip_test.go
+6
-6
No files found.
middleware/gzip/gzip_test.go
View file @
9e97d79c
...
@@ -76,24 +76,24 @@ func nextFunc(shouldGzip bool) middleware.Handler {
...
@@ -76,24 +76,24 @@ func nextFunc(shouldGzip bool) middleware.Handler {
return
middleware
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
(
int
,
error
)
{
return
middleware
.
HandlerFunc
(
func
(
w
http
.
ResponseWriter
,
r
*
http
.
Request
)
(
int
,
error
)
{
if
shouldGzip
{
if
shouldGzip
{
if
r
.
Header
.
Get
(
"Accept-Encoding"
)
!=
""
{
if
r
.
Header
.
Get
(
"Accept-Encoding"
)
!=
""
{
return
0
,
fmt
.
Errorf
(
"
a
ccept-Encoding header not expected"
)
return
0
,
fmt
.
Errorf
(
"
A
ccept-Encoding header not expected"
)
}
}
if
w
.
Header
()
.
Get
(
"Content-Encoding"
)
!=
"gzip"
{
if
w
.
Header
()
.
Get
(
"Content-Encoding"
)
!=
"gzip"
{
return
0
,
fmt
.
Errorf
(
"
c
ontent-Encoding must be gzip, found %v"
,
r
.
Header
.
Get
(
"Content-Encoding"
))
return
0
,
fmt
.
Errorf
(
"
C
ontent-Encoding must be gzip, found %v"
,
r
.
Header
.
Get
(
"Content-Encoding"
))
}
}
if
_
,
ok
:=
w
.
(
gzipResponseWriter
);
!
ok
{
if
_
,
ok
:=
w
.
(
gzipResponseWriter
);
!
ok
{
return
0
,
fmt
.
Errorf
(
"
r
esponseWriter should be gzipResponseWriter, found %T"
,
w
)
return
0
,
fmt
.
Errorf
(
"
R
esponseWriter should be gzipResponseWriter, found %T"
,
w
)
}
}
return
0
,
nil
return
0
,
nil
}
}
if
r
.
Header
.
Get
(
"Accept-Encoding"
)
==
""
{
if
r
.
Header
.
Get
(
"Accept-Encoding"
)
==
""
{
return
0
,
fmt
.
Errorf
(
"
a
ccept-Encoding header expected"
)
return
0
,
fmt
.
Errorf
(
"
A
ccept-Encoding header expected"
)
}
}
if
w
.
Header
()
.
Get
(
"Content-Encoding"
)
==
"gzip"
{
if
w
.
Header
()
.
Get
(
"Content-Encoding"
)
==
"gzip"
{
return
0
,
fmt
.
Errorf
(
"
c
ontent-Encoding must not be gzip, found gzip"
)
return
0
,
fmt
.
Errorf
(
"
C
ontent-Encoding must not be gzip, found gzip"
)
}
}
if
_
,
ok
:=
w
.
(
gzipResponseWriter
);
ok
{
if
_
,
ok
:=
w
.
(
gzipResponseWriter
);
ok
{
return
0
,
fmt
.
Errorf
(
"
r
esponseWriter should not be gzipResponseWriter"
)
return
0
,
fmt
.
Errorf
(
"
R
esponseWriter should not be gzipResponseWriter"
)
}
}
return
0
,
nil
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