samedi 20 août 2016

Ember-data RESTAdapter without JSON payload

In my Ember v2.7.0 app, I need to use backend endpoint which does not return JSON payload. But it behaves like REST endpoint, so I thought I would just use DS.RESTAdapter to fetch the data and convert the payload via DS.Serializer.

Created this little Ember-twiddle, which just tries to fetch data with non-JSON payload. And it fails. As far as I can tell, it fails in DS.RESTAdapter code, trying to extract JSON from the payload. So that my serializer does not have a chance to process the data.

This seems a bit odd, because I thought that Serializer is the layer which is responsible for munching the payload.

  1. Is it possible to use DS.RESTAdapter for querying non-JSON endpoint?
  2. If not, what is the easiest way to have REST-like behaviour on non-JSON endpoint?



Aucun commentaire:

Enregistrer un commentaire