2015-02-09 18:37:06 +00:00
|
|
|
package tusd
|
|
|
|
|
|
|
|
import (
|
|
|
|
"net/http"
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestOptions(t *testing.T) {
|
2015-11-04 23:46:22 +00:00
|
|
|
handler, _ := NewRoutedHandler(Config{
|
2015-02-09 18:37:06 +00:00
|
|
|
MaxSize: 400,
|
|
|
|
})
|
|
|
|
|
2015-02-17 14:44:12 +00:00
|
|
|
(&httpTest{
|
|
|
|
Name: "Successful request",
|
|
|
|
Method: "OPTIONS",
|
|
|
|
Code: http.StatusNoContent,
|
|
|
|
ResHeader: map[string]string{
|
2015-03-23 18:02:39 +00:00
|
|
|
"Tus-Extension": "creation,concatenation,termination",
|
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
|
|
|
}
|