Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
7ccf049a
Commit
7ccf049a
authored
Nov 10, 2015
by
JessonChan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fixed
parent
7964f7f1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
10 deletions
+13
-10
acceptencoder_test.go
acceptencoder/acceptencoder_test.go
+13
-10
No files found.
acceptencoder/acceptencoder_test.go
View file @
7ccf049a
...
...
@@ -14,29 +14,32 @@
package
acceptencoder
import
"testing"
import
(
"net/http"
"testing"
)
func
Test_ExtractEncoding
(
t
*
testing
.
T
)
{
if
parseEncoding
(
"gzip,deflate"
)
!=
"gzip"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip,deflate"
}}}
)
!=
"gzip"
{
t
.
Fail
()
}
if
parseEncoding
(
"deflate,gzip"
)
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"deflate,gzip"
}}}
)
!=
"deflate"
{
t
.
Fail
()
}
if
parseEncoding
(
"gzip;q=.5,deflate"
)
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=.5,deflate"
}}})
!=
"deflate"
{
t
.
Fail
()
}
if
parseEncoding
(
"gzip;q=0,deflate"
)
!=
"deflate"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=.5,deflate;q=0.3"
}}})
!=
"gzip"
{
t
.
Fail
()
}
if
parseEncoding
(
"deflate;q=0.5,gzip;q=0.5,identity"
)
!=
"
"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"gzip;q=0,deflate"
}}})
!=
"deflate
"
{
t
.
Fail
()
}
if
parseEncoding
(
"*"
)
!=
"gzip"
{
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"deflate;q=0.5,gzip;q=0.5,identity"
}}})
!=
"identity"
{
t
.
Fail
()
}
if
parseEncoding
(
&
http
.
Request
{
Header
:
map
[
string
][]
string
{
"Accept-Encoding"
:
[]
string
{
"*"
}}})
!=
"*"
{
t
.
Fail
()
}
}
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