tusd/options_test.go

36 lines
655 B
Go
Raw Permalink Normal View History

2015-12-25 21:33:27 +00:00
package tusd_test
2015-02-09 18:37:06 +00:00
import (
"net/http"
"testing"
2015-12-25 21:33:27 +00:00
. "github.com/tus/tusd"
2015-02-09 18:37:06 +00:00
)
func TestOptions(t *testing.T) {
handler, _ := NewHandler(Config{
MaxSize: 400,
})
2015-02-17 14:44:12 +00:00
(&httpTest{
Name: "Successful request",
Method: "OPTIONS",
Code: http.StatusNoContent,
ResHeader: map[string]string{
"Tus-Extension": "creation,concatenation",
2015-03-23 17:15:05 +00:00
"Tus-Version": "1.0.0",
"Tus-Resumable": "1.0.0",
"Tus-Max-Size": "400",
2015-02-17 14:44:12 +00:00
},
}).Run(handler, t)
2015-02-09 18:37:06 +00:00
2015-02-17 14:44:12 +00:00
(&httpTest{
Name: "Invalid or unsupported version",
Method: "POST",
ReqHeader: map[string]string{
2015-03-23 17:15:05 +00:00
"Tus-Resumable": "foo",
2015-02-17 14:44:12 +00:00
},
Code: http.StatusPreconditionFailed,
}).Run(handler, t)
2015-02-09 18:37:06 +00:00
}