I’m using JsonRestStore but would like to add a custom Accept header to it. What’s the best way to go about this?
This is similar to how the dijit.layout.ContentPane allows you to affect the underlying XHR by setting ioArgs. So the question could be “what is JsonRestStore’s ioArgs?”
I’m using declarative syntax, but would gladly like to see both methods…
(Please note: I’m not interested in hacking my way around this by modifying the base XHR.)
Your best bet is providing a custom service to
JsonRestStore. The easiest way I found of doing this is building the service fromdojox.rpc.Rest. In the constructor you can provide a function to create the request arguments for all XHR requests. E.g.This completely ignores the
argsparameter that can include sorting and range arguments to your service.These links will provide more information:
service._getRequest)