提交 2f159385 编写于 作者: G George Claghorn

Fix S3 direct upload test

上级 2cd1b883
......@@ -9,25 +9,15 @@ class ActiveStorage::Service::S3ServiceTest < ActiveSupport::TestCase
include ActiveStorage::Service::SharedServiceTests
test "direct upload" do
# FIXME: This test is failing because of a mismatched request signature, but it works in the browser.
skip
begin
key = SecureRandom.base58(24)
data = "Something else entirely!"
direct_upload_url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size)
url = URI.parse(direct_upload_url).to_s.split("?").first
query = CGI::parse(URI.parse(direct_upload_url).query).collect { |(k, v)| [ k, v.first ] }.to_h
url = @service.url_for_direct_upload(key, expires_in: 5.minutes, content_type: "text/plain", content_length: data.size)
HTTParty.post(
HTTParty.put(
url,
query: query,
body: data,
headers: {
"Content-Type": "text/plain",
"Origin": "http://localhost:3000"
},
headers: { "Content-Type" => "text/plain" },
debug_output: STDOUT
)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册