mattgreen / elevate

Streamline your RubyMotion controllers
MIT License
126 stars 10 forks source link

JSON automatically parsed #7

Closed tchukuchuk closed 11 years ago

tchukuchuk commented 11 years ago

Hello,

I don't understand why you automatically parse JSON response. In fact, I would like to test the returned code (response.code), then call response.body.

https://github.com/mattgreen/elevate/blob/master/lib/elevate/http/response.rb#L34

Best regards,

Julien

tchukuchuk commented 11 years ago

My other problem is that the hash provided is not mutable, and I need to update it to store data with core data. Is it possible to add something like this ?

https://github.com/rubymotion/BubbleWrap/blob/master/motion/core/json.rb#L18

Best regards,

Julien

tchukuchuk commented 11 years ago

I have just seen that I can use Elevate::HTTP::Response#raw_body , so I can parse it with BW::JSON.parse :)

mattgreen commented 11 years ago

Why wouldn't I automatically parse JSON bodies? It all happens in the worker thread anyway.

tchukuchuk commented 11 years ago

I use a lot BW::HTTP, and the returned response has a different behaviour especially for JSON. Anyway, I prefer use Response#raw_body instead of Response#body. Thanks for your reply.

mattgreen commented 11 years ago

The point is to try to improve upon what we have, rather than merely imitating it.

I'll close this issue with the intent of documenting this behavior.