lib/nightcrawler_swift/upload.rb in nightcrawler_swift-0.2.1 vs lib/nightcrawler_swift/upload.rb in nightcrawler_swift-0.2.2
- old
+ new
@@ -1,9 +1,10 @@
module NightcrawlerSwift
class Upload < Command
def execute path, file
- response = put "#{connection.upload_url}/#{path}", body: file.read
+ content_type = MultiMime.by_file(file).content_type
+ response = put "#{connection.upload_url}/#{path}", body: file.read, headers: {content_type: content_type}
[200, 201].include?(response.code)
end
end
end