Correspondence when the response of the external API is application/pdf
response = http_client.get url
response.headers
# {
# "content-type"=>"application/pdf",
# }
#If you write it simply, it's ok
file = ::File.open("path/to/pdf", "wb") do |f|
f.write resp.body
f
end
# AWS::S3.upload file.path
#Like
$ file path/to/pdf
# path/to/pdf: PDF document, version 1.4
Recommended Posts