Date
1 - 5 of 5
2XX response codes
Gonzalo <gonzalo@...>
Hi all,
I'm receiving 207 (read-only resource) codes from my application server and those responses are treated as Exceptions, as if they were 4xx or 5XX errors. I think that full 2XX code range should be treated the same way... (no RestClient::Exception) What do you think? I'm pretty new to software development and maybe I'm wrong. Thanks for your comments. Best regards. Gonzalo.
|
|
Archiloque <code@...>
I think you are right, I think we just miss this code because it isn't in the the standard http response list, I'll add it for the next release
toggle quoted messageShow quoted text
A.
Le 24 mai 2010 à 21:07, Gonzalo a écrit :
Hi all,
|
|
Gonzalo <gonzalo@...>
I A,
toggle quoted messageShow quoted text
Cool! It is great to hear that. Right now, we have to grab 207 with the Exception clause and repeat some standard code there. But we 'll remove that hack when next rest-client is released. It would be nice if there were some kind of mechanism so we could enable the standard handling for codes higher than 207. I'm sure this feature will be nice for many people that use 2XX codes as server responses for their web services. Thanks for all! Best regards, Gonzalo.
On May 24, 2010, at 9:30 PM, Archiloque wrote:
I think you are right, I think we just miss this code because it
|
|
Archiloque <code@...>
By exception clause do you mean a begin/rescue ?
toggle quoted messageShow quoted text
Because you can use a block to change the code behavior for non standard return code, see the "Result handling" section of the documentation : # handle the 207 case, won't be necessary in next version RestClient.get('http://my-rest-service.com/resource'){ |response, &block| if response.code == 207 p '207, yeah !' response else response.return! &block end } And it seems to fill the needs you described A.
Le 24 mai 2010 à 21:56, Gonzalo a écrit :
I A,
|
|
Gonzalo <gonzalo@...>
Hi A,
toggle quoted messageShow quoted text
I'll give a look to the documentation, but the thing you've described seems to do the job! Many thanks for the tip! Regards, Gonzalo.
On May 24, 2010, at 10:36 PM, Archiloque wrote:
By exception clause do you mean a begin/rescue ?
|
|