javascript - How to set multiple request headers on each request -
i'm not sure how set multiple request headers each ajax request. have now:
ext.ajax.on("beforerequest", function(conn, request){ request.headers = request.headers || {}; return request.headers.authorization = "bearer " + ext.util.cookies.get("token"); }, this);
as can see, i'm setting here 1 authorization token. want set 1 more header in order submit called "refresh" token server. how can that? way, need access cookies , set headers on each request, because data in cookies may change. can not set headers once , time.
just add multiple headers headers
object. note don't need (or want) return value of of headers function:
ext.ajax.on("beforerequest", function(conn, request){ request.headers = request.headers || {}; request.headers.authorization = "bearer " + ext.util.cookies.get("token"); request.headers.somthingelse = ext.util.cookies.get("something-else"); // *** }, this);
Comments
Post a Comment