@ricardos wrote:
Hi,
When performing a GET request with a nested JSON parameter, its value is being serialised into a string, which then needs to be parsed in the Rails backend:
Started GET "/api/data/index.json?query=%7B%22term%22:%22abc%22,%22paginated%22:true%7D" for ::1 at 2017-07-07 14:56:29 +1000 Processing by Api::DataController#index as JSON Parameters: {"query"=>"{\"term\":\"abc\",\"paginated\":true}", "datum"=>{}}
Is there a way to serialise the request like a POST? What I wanted is what a browser does when submitting the same URL (http://localhost:3000/api/data/index?query={term:'abc',paginated:true}). The server receives a hash instead of a string:
Started GET "/api/data/index?query={term:'abc',paginated:true}" for ::1 at 2017-07-07 15:00:44 +1000 Processing by Api::DataController#index as HTML Parameters: {"query"=>"{term:'abc',paginated:true}"}
Googling this subject I found that Angular.js previously offered an alternative serializer,
$httpParamSerializerJQLike
, but that doesn't seem to be the case for Angular2 anymore? Also, I couldn't figure how this could be used in Ionic, as theHttp
object is injected and there's no documentation on how to configure it?Any help on the subject is appreciated...
Thanks, Ricardo
Posts: 3
Participants: 2