lib/nightcrawler_swift/commands/upload.rb in nightcrawler_swift-0.4.0 vs lib/nightcrawler_swift/commands/upload.rb in nightcrawler_swift-0.5.0
- old
+ new
@@ -2,15 +2,12 @@
class Upload < Command
def execute path, file
content = file.read
headers = {etag: etag(content), content_type: content_type(file)}
- headers.merge!(cache_control: "max-age=#{options.max_age}") if options.max_age
+ headers.merge!(cache_control: "public, max-age=#{options.max_age}") if options.max_age
response = put "#{connection.upload_url}/#{path}", body: content, headers: headers
[200, 201].include?(response.code)
-
- rescue RestClient::UnprocessableEntity => e
- raise Exceptions::ValidationError.new(e)
end
private
def content_type file
MultiMime.by_file(file).content_type