PredixDev/predix-rest-client

RestClientImpl is returning an Exception on Partial Response (Http code 206)

Closed this issue · 3 comments

Hi All, Not sure if this is the expected behavior or a Bug but RestClientImpl.performGet() method is returning a RuntimeException when Predix Asset service Http response is indicating a Partial Response with an HTTP Code 206 (if, for instance, you are retrieving a whole collection and the collection has more than 100 records).

From this line:
if (httpResponse.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("unable able to connect to the url=" + url2 + " response=" + httpResponse);
}

Tthis is preventing the client code (my code, for instance) to get those records because of the Exception. Even If I use paging, I mean, when sending pageSize=99 if the collections has more than 100 records Predix Asset will also return an HTTP code 206 and so RestClientImpl won't return the records but an exception.

Thanks in advance for any help or insight on this,

JP

Seems like a bug to me. We should probably allow all the 2xx HTTP response codes, instead of throwing Runtime Exception. I'll discuss with the team. Thanks!

Fixed by @katyatalluri. Please let us know if you see more issues.

That's good news, Thank you!

Sure, I will let you know if we found any other issue.

Regards.

JP

On Tue, Aug 2, 2016 at 2:36 PM, Greg Stroup notifications@github.com
wrote:

Fixed by @katyatalluri https://github.com/katyatalluri. Please let us
know if you see more issues.


You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
#6 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAt7ARxkEfFcVEXTI9J2ljuN5jwScrViks5qb4ANgaJpZM4JXfOt
.