Add an empty OPTIONS route

Uppy makes requests to the OPTIONS route before the upload, so we add a handler that just returns a successful response. Fixes #12
parent fc55fac9
...@@ -54,6 +54,11 @@ module Uppy ...@@ -54,6 +54,11 @@ module Uppy
{ uploadId: result.fetch(:upload_id), key: result.fetch(:key) } { uploadId: result.fetch(:upload_id), key: result.fetch(:key) }
end end
# OPTIONS /s3/multipart
r.options ["", true] do
r.halt 204
end
# GET /s3/multipart/:uploadId # GET /s3/multipart/:uploadId
r.get String do |upload_id| r.get String do |upload_id|
key = param!("key") key = param!("key")
......
...@@ -110,6 +110,16 @@ describe Uppy::S3Multipart::App do ...@@ -110,6 +110,16 @@ describe Uppy::S3Multipart::App do
end end
end end
describe "OPTIONS /s3/multipart" do
it "returns an empty response" do
response = app.options "/s3/multipart"
assert_equal 204, response.status
assert_equal Hash.new, response.headers
assert_equal "", response.body_binary
end
end
describe "GET /s3/multipart/:uploadId" do describe "GET /s3/multipart/:uploadId" do
it "fetches multipart parts" do it "fetches multipart parts" do
response = app.get "/s3/multipart/foo", query: { key: "bar" } response = app.get "/s3/multipart/foo", query: { key: "bar" }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment