module Stash::Sword::HeaderUtils
Constants
- APPLICATION_ZIP
- CONTENT_DISPOSITION
- MULTIPART_RELATED_ATOM_XML
- SIMPLE_ZIP
Attributes
on_behalf_of[R]
CONTENT_DISPOSITION
= 'form-data'.freeze
Public Instance Methods
create_request_headers(zipfile, slug)
click to toggle source
# File lib/stash/sword/header_utils.rb, line 13 def create_request_headers(zipfile, slug) { 'Content-Type' => APPLICATION_ZIP, 'Content-Disposition' => "#{CONTENT_DISPOSITION}; filename=#{File.basename(zipfile)}", 'Packaging' => SIMPLE_ZIP, 'Content-MD5' => Digest::MD5.file(zipfile).to_s, 'On-Behalf-Of' => on_behalf_of, 'Slug' => slug } end
update_mime_headers(zipfile)
click to toggle source
# File lib/stash/sword/header_utils.rb, line 33 def update_mime_headers(zipfile) { 'Content-Type' => APPLICATION_ZIP, 'Content-Disposition' => "#{CONTENT_DISPOSITION}; name=\"payload\"; filename=\"#{File.basename(zipfile)}\"", 'Packaging' => SIMPLE_ZIP, 'Content-MD5' => Digest::MD5.file(zipfile).to_s, 'MIME-Version' => '1.0' } end
update_request_headers(stream, boundary)
click to toggle source
# File lib/stash/sword/header_utils.rb, line 24 def update_request_headers(stream, boundary) { 'Content-Length' => stream.size.to_s, 'Content-Type' => "#{MULTIPART_RELATED_ATOM_XML}; boundary=\"#{boundary}\"", 'On-Behalf-Of' => on_behalf_of, 'MIME-Version' => '1.0' } end