tusd/options_test.go

34 lines
641 B
Go
Raw Normal View History

2015-02-09 18:37:06 +00:00
package tusd
import (
"net/http"
"testing"
)
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": "file-creation,concatenation,termination",
2015-02-17 14:44:12 +00:00
"TUS-Version": "1.0.0",
"TUS-Resumable": "1.0.0",
"TUS-Max-Size": "400",
},
}).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{
"TUS-Resumable": "foo",
},
Code: http.StatusPreconditionFailed,
}).Run(handler, t)
2015-02-09 18:37:06 +00:00
}