Dojo Data grid with custom HTTP headers

2019-07-29 06:29发布

I have DataGrid that connects to REST service. I need to pass some custom HTTP headers (Authorization and others) to fetch operation. How can I do that?

Data store is JsonRestStore.

1条回答
一夜七次
2楼-- · 2019-07-29 06:45

Better late than never... Here's a workaround; add this function at the beginning of the dojo.addOnLoad() method.

dojo.xhrGet = function(args){// Workaround for Dojo's lack of support for custom headers
   args.headers = {userId:'xyz', requestedBy:'abc', requestedFrom:'123'};
   return dojo.xhr("GET", args);
};
查看更多
登录 后发表回答