2019-07-03 20:02:32 +02:00
|
|
|
package drivers_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
. "github.com/smartystreets/goconvey/convey"
|
2019-08-04 23:25:47 +02:00
|
|
|
|
|
|
|
"github.com/MontFerret/ferret/pkg/drivers"
|
2019-07-03 20:02:32 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestHTTPHeader(t *testing.T) {
|
2019-08-04 23:25:47 +02:00
|
|
|
Convey("HTTPHeaders", t, func() {
|
2019-07-03 20:02:32 +02:00
|
|
|
Convey(".MarshalJSON", func() {
|
|
|
|
Convey("Should serialize header values", func() {
|
2019-08-04 23:25:47 +02:00
|
|
|
headers := make(drivers.HTTPHeaders)
|
2019-07-03 20:02:32 +02:00
|
|
|
|
2019-08-04 23:25:47 +02:00
|
|
|
headers["Content-Encoding"] = []string{"gzip"}
|
|
|
|
headers["Content-Type"] = []string{"text/html", "charset=utf-8"}
|
2019-07-03 20:02:32 +02:00
|
|
|
|
|
|
|
out, err := headers.MarshalJSON()
|
|
|
|
|
|
|
|
So(err, ShouldBeNil)
|
2019-08-04 23:25:47 +02:00
|
|
|
So(string(out), ShouldEqual, `{"Content-Encoding":"gzip","Content-Type":"text/html, charset=utf-8"}`)
|
2019-07-03 20:02:32 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|