frontapp icon indicating copy to clipboard operation
frontapp copied to clipboard

Empty body for attachments

Open dpaola2 opened this issue 4 years ago • 1 comments

When using the download_attachment method for an image, the response body does not contain the image content.

When I drop down and use HTTP directly, the response.ready_body invocation returns the binary data correctly but it doesn't seem to make it up into the frontapp gem's response.

dpaola2 avatar Mar 22 '21 18:03 dpaola2

I've monkey patched my API client wrapper with the following code in order to support this:

def download_attachment(attachment_id)
    url = URI("https://api2.frontapp.com/download/#{attachment_id}")

    http = Net::HTTP.new(url.host, url.port)
    http.use_ssl = true

    request = Net::HTTP::Get.new(url)
    request["Accept"] = 'application/json'
    request["Authorization"] = "Bearer #{api_token}"

    response = http.request(request)
    response
  end

dpaola2 avatar Mar 24 '21 22:03 dpaola2