Class: Covered::Coveralls::Wrapper
- Inherits:
-
Async::REST::Wrapper::JSON
- Object
- Async::REST::Wrapper::JSON
- Covered::Coveralls::Wrapper
- Defined in:
- lib/covered/coveralls.rb
Instance Method Summary collapse
Instance Method Details
#prepare_request(payload, headers) ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/covered/coveralls.rb', line 29 def prepare_request(payload, headers) headers['accept'] ||= @content_type boundary = SecureRandom.hex(32) # This is a pretty messed up API. Don't change anything below. It's fragile. if payload headers['content-type'] = "multipart/form-data, boundary=#{boundary}" Async::HTTP::Body::Buffered.new([ "--#{boundary}\r\n", "Content-Disposition: form-data; name=\"json_file\"; filename=\"body.json\"\r\n", "Content-Type: text/plain\r\n\r\n", ::JSON.dump(payload), "\r\n--#{boundary}--\r\n", ]) end end |