Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty body for attachments #15

Open
dpaola2 opened this issue Mar 22, 2021 · 1 comment
Open

Empty body for attachments #15

dpaola2 opened this issue Mar 22, 2021 · 1 comment

Comments

@dpaola2
Copy link

dpaola2 commented Mar 22, 2021

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
Copy link
Author

dpaola2 commented Mar 24, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant