mirror of
https://github.com/astaxie/beego.git
synced 2024-11-25 22:51:29 +00:00
Revert "go test fixed"
This commit is contained in:
parent
77113e843c
commit
c3d1e4d088
@ -18,7 +18,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"compress/flate"
|
"compress/flate"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"compress/zlib"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
@ -32,13 +31,9 @@ type acceptEncoder struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
noneCompressEncoder = acceptEncoder{"", func(wr io.Writer, level int) (io.Writer, error) { return wr, nil }}
|
noneCompressEncoder = acceptEncoder{"", func(wr io.Writer, level int) (io.Writer, error) { return wr, nil }}
|
||||||
gzipCompressEncoder = acceptEncoder{"gzip", func(wr io.Writer, level int) (io.Writer, error) { return gzip.NewWriterLevel(wr, level) }}
|
gzipCompressEncoder = acceptEncoder{"gzip", func(wr io.Writer, level int) (io.Writer, error) { return gzip.NewWriterLevel(wr, level) }}
|
||||||
//according to the sec :http://tools.ietf.org/html/rfc2616#section-3.5 ,the deflate compress in http is zlib indeed
|
deflateCompressEncoder = acceptEncoder{"deflate", func(wr io.Writer, level int) (io.Writer, error) { return flate.NewWriter(wr, level) }}
|
||||||
//deflate
|
|
||||||
//The "zlib" format defined in RFC 1950 [31] in combination with
|
|
||||||
//the "deflate" compression mechanism described in RFC 1951 [29].
|
|
||||||
deflateCompressEncoder = acceptEncoder{"deflate", func(wr io.Writer, level int) (io.Writer, error) { return zlib.NewWriterLevel(wr, level) }}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"compress/flate"
|
"compress/flate"
|
||||||
"compress/gzip"
|
"compress/gzip"
|
||||||
"compress/zlib"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
@ -44,7 +43,7 @@ func TestOpenStaticFileGzip_1(t *testing.T) {
|
|||||||
func TestOpenStaticFileDeflate_1(t *testing.T) {
|
func TestOpenStaticFileDeflate_1(t *testing.T) {
|
||||||
file, _ := os.Open(licenseFile)
|
file, _ := os.Open(licenseFile)
|
||||||
var zipBuf bytes.Buffer
|
var zipBuf bytes.Buffer
|
||||||
fileWriter, _ := zlib.NewWriterLevel(&zipBuf, flate.BestCompression)
|
fileWriter, _ := flate.NewWriter(&zipBuf, flate.BestCompression)
|
||||||
io.Copy(fileWriter, file)
|
io.Copy(fileWriter, file)
|
||||||
fileWriter.Close()
|
fileWriter.Close()
|
||||||
content, _ := ioutil.ReadAll(&zipBuf)
|
content, _ := ioutil.ReadAll(&zipBuf)
|
||||||
|
Loading…
Reference in New Issue
Block a user