Downloading PDF file with GET request okhttp error

By | October 30, 2018

fellow community!

So I have this simple request using Retrofit 2

@Headers("Content-Type: application/pdf")
Call<ResponseBody> downloadPdf(@Header("Authorization") String accessToken, @Path("id") int id);

I’ve laso tried to add @Streaming annotation

Which should trigger web server and start download

I am always getting error HTTP FAILED: unexpected end of stream on Connection{server_ip_here , proxy=DIRECT@ hostAddress=/server_ip_address cipherSuite=none protocol=http/1.1}

Do you have some library to recommend or some clues why this is happening?

Thank you


Leave a Reply

Your email address will not be published. Required fields are marked *