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{
|
2015-02-28 13:47:39 +00:00
|
|
|
"TUS-Extension": "file-creation,metadata,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
|
|
|
}
|