mirror of
https://github.com/astaxie/beego.git
synced 2024-12-23 12:00:50 +00:00
bug fixed
This commit is contained in:
parent
7964f7f163
commit
7ccf049a50
@ -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(&http.Request{Header: map[string][]string{"Accept-Encoding": []string{"gzip;q=.5,deflate"}}}) != "deflate" {
|
||||
t.Fail()
|
||||
}
|
||||
if parseEncoding(&http.Request{Header: map[string][]string{"Accept-Encoding": []string{"gzip;q=.5,deflate;q=0.3"}}}) != "gzip" {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if parseEncoding("gzip;q=.5,deflate") != "deflate" {
|
||||
if parseEncoding(&http.Request{Header: map[string][]string{"Accept-Encoding": []string{"gzip;q=0,deflate"}}}) != "deflate" {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if parseEncoding("gzip;q=0,deflate") != "deflate" {
|
||||
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("deflate;q=0.5,gzip;q=0.5,identity") != "" {
|
||||
t.Fail()
|
||||
}
|
||||
|
||||
if parseEncoding("*") != "gzip" {
|
||||
if parseEncoding(&http.Request{Header: map[string][]string{"Accept-Encoding": []string{"*"}}}) != "*" {
|
||||
t.Fail()
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user