janhommes / o.js

o.js - client side oData lib.
https://janhommes.github.io/o.js/example/
MIT License
238 stars 57 forks source link

Q.JS dependency #49

Closed a2life closed 7 years ago

a2life commented 7 years ago

Hi could you double check if q.js dependency was fixed in V-0.3.1? I am still seeing the 'defer' undefined error once I remove Q.js link from my markup.

I am also seeing unless I configure "content-type: application/json" in the header, SharePoint REST service returns xml payload instead of json, so the code bombs out at the first character of JSON.parse(response) . I am not sure if this is a particular issue with Microsoft SharePoint service.

janhommes commented 7 years ago

Hi,

can you check this commit for the Q dependency if its then working?

For the second point: o.js assuming that your service returning JSON by default or was using the v3 property $format=json. Maybe we can set it as default value for all v4 services. Are you sure it is safe to set this header by default?

Regards Jan

a2life commented 7 years ago

Hi No dice. o.js:455 Uncaught TypeError: Cannot read property 'defer' of null

Also for the second point, I mentioned "content-type' but it is actually 'Accept' header that I need to set up. If you look at MS site page that explains SharePoint service page here, https://msdn.microsoft.com/en-us/library/office/dn531433.aspx

Accept header : Specifies the format for response data from the server. The default format is application/atom+xml. Example:

janhommes commented 7 years ago

Okay, here another try. Can you pls test this version (sorry, I have no real test service any more)?

I think we could safely set the accept header to JSON. I will implement this enhancement as soon as we fix the promise bug.

a2life commented 7 years ago

Thank you, it is finally working.