PredixDev / predix-rest-client

Other
7 stars 16 forks source link

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

Closed olguin closed 8 years ago

olguin commented 8 years ago

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

gstroup commented 8 years ago

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!

gstroup commented 8 years ago

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

olguin commented 8 years ago

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 https://github.com/PredixDev/predix-rest-client/issues/6#issuecomment-236980922, or mute the thread https://github.com/notifications/unsubscribe-auth/AAt7ARxkEfFcVEXTI9J2ljuN5jwScrViks5qb4ANgaJpZM4JXfOt .