DoJo Toolkit 未根据请求设置附加标头
我正在使用 DoJo 1.6.1 访问我的 REST Web 服务。要获取 JSON 格式的响应,我需要将 Aceept
标头字段设置为 application/json
。
根据 DoJo 文档,这是通过在请求上设置 headers
属性来完成的,如下所示:
var xhrArgs = {
url: "http://localhost/myservice",
headers: { "Accept": "application/json" },
handleAs: "json",
load: successCallback,
error: errorCallback
}
var deferred = dojo.xhrGet(xhrArgs);
我还使用了 dojo.io.script.get(jsonpArgs);
和同样的问题:accept 在服务器端的值为 */*
。我使用的是 Firefox 5.0.1(也尝试过 Windows 上的 Safari 和 Firefox)。
有什么建议吗?问题是什么? 提前致谢! :)
I'm using DoJo 1.6.1 for accessing my REST web service. To get the response in JSON I need to set the Aceept
header field to application/json
.
According to the DoJo documentation this is done by setting the headers
property on the request, like to following:
var xhrArgs = {
url: "http://localhost/myservice",
headers: { "Accept": "application/json" },
handleAs: "json",
load: successCallback,
error: errorCallback
}
var deferred = dojo.xhrGet(xhrArgs);
I also used dojo.io.script.get(jsonpArgs);
with the same issue: accept is of the value */*
on the server side. I'm using Firefox 5.0.1 (also tried with Safari and Firefox on Windows).
Any suggestions what the problem is?
Thanks in advance! :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论