1 Reply Latest reply on Jun 12, 2013 11:50 AM by Kutir Mobility

    Rhodes 4.0.0.beta1 not parse JSON response

      I have the following Async Request:

      Rho::AsyncHttp.post(
         :url => "www.xample.com/api/path.json",
        :headers  => {"Content-Type" => "application/json; charset=utf-8", "Accept" => "application/json"},
        :body => "data=value",
         :callback => url_for(:action => :httppost_callback)
      )
      

       

      When testing with Rhodes 3.5.1.13, the response body is auto-parsed from JSON to Ruby hash. However, when testing with Rhodes 4.0.0.beta1, the response body is still a JSON string.

      Is it a bug or Rhodes 4.0 will not auto-parse JSON response?

        • Re: Rhodes 4.0.0.beta1 not parse JSON response
          Kutir Mobility

          I have found the network code in early betas to not always do what it was supposed to. Have you tried beta21 which was released recently? You can get it at https://developer.motorolasolutions.com/docs/DOC-1817

           

           

          The syntax for the new Network API is a bit different:

           

          Rho::Network.post ( {
             :url => "www.example.com/api/path.json",  
            :headers  => {"Content-Type" => "application/json; charset=utf-8", "Accept" => "application/json"},  
            :body => "data=value"
          }, url_for(:action => :httppost_callback)
          )
          

           

          The old APIs will still be supported, but if you want to experiment with the beta, I'd recommend starting to use the new APIs.

           

          Thanks,

          Javier

          Kutir Mobility