Closed lllyyylll2 closed 7 years ago
Hm, maybe we can add a .headers
function which overrides the configured headers:
// +++
// Override the default headers. Empty restes them.
// Example: .headers([{name: 'custome', value: 'some'}]).get().headers()
// +++
base.headers = function (headers) {
if(typeof headers !== 'undefined') {
base.oConfig['_headers'] = base.oConfig.headers;
base.oConfig.headers = headers;
}
else {
base.oConfig.headers = base.oConfig['_headers'] || base.oConfig.headers;
}
return base;
},
This peace of code is not tested. Maybe you can give it a try?
I need set custom header in my project when executing some special request. eg:
but I only found the global setting method .
Can you provide an interface to do this , like changing "get()" method to add an extra prarameter named "headers" ?