如何发送与angularJS资源多个头? [英] How do I send multiple headers with angularJS resource?
本文介绍了如何发送与angularJS资源多个头?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
试图与angularJS相同的请求发送多个标头,这是我有...
Trying to send multiple headers in the same request with angularJS this is what I have...
var auth = $resource("",
{},
{
GetUserDetails: {
url: Config.api.user.details(),
method: 'POST',
isArray: false,
cache: false,
headers: ["xx:xx","ff:ff"]
}
});
但请求只是表明...
But the request just shows...
0:xx:xx
1:ff:ff
Accept:application/json, text/plain, */*
Accept-Encoding:gzip,deflate
Accept-Language:en-GB,en-US;q=0.8,en;q=0.6
Cache-Control:no-cache
任何人都知道正确的数据结构向下发送头集合中的头财产上的资源?
Anyone know the right data structure to send a collection of headers down in the headers property on the resource?
推荐答案
直接从的文档:
标题 - {}对象 - 地图,返回字符串重新presenting HTTP标头发送到服务器的字符串或功能。如果函数的返回值为null,则头将不会被发送。
headers – {Object} – Map of strings or functions which return strings representing HTTP headers to send to the server. If the return value of a function is null, the header will not be sent.
所以,你需要的是:
headers: {
headerName1: 'headerValue1',
headerName2: 'headerValue2'
}
这篇关于如何发送与angularJS资源多个头?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文