开发者

YUI 3: Setting request headers with DataSource.IO

I need to retrieve a JSON resource which requires HTTP Basic authentication. Therefore, I need to set a request header for a DataSource.IO object.

I see that the IO utility itself supports a header key in its configuration object. However, since I'm new to YUI, I can't figure out how to set this configuration value through the mediation of DataSource.

To be clear, I don't need help constructing a correct Authorizatio开发者_运维技巧n header, just getting YUI to send the headers I construct. Thanks much.


You can set IO config values via DataSource.IO's ioConfig config object:

var ds = new Y.DataSource.IO({
    source: "script.php",
    ioConfig: {
        method: "POST",
        data: "foo=bar",
        timeout: 1000
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜