class Covered::Coveralls::Wrapper

Public Instance Methods

prepare_request(payload, headers) click to toggle source
# 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