Worklight: WL.Client.addGlobalHeader() has no effect

做~自己de王妃 提交于 2019-12-13 04:46:06

问题


When I add the line

WL.Client.addGlobalHeader("MyCustomHeader","abcdefgh");

inside of my main js file like so

function wlCommonInit(){

WL.Client.addGlobalHeader("MyCustomHeader","abcdefgh");
    (...)

like it's described in the documentation (http://pic.dhe.ibm.com/infocenter/wrklight/v5r0m5/topic/com.ibm.worklight.help.doc/apiref/r_wl_client_addglobalheader.html) this has absolutely no effect all request send after that:

GET /apps/services/preview/MobileOPMClient/common/0/default/images/icons/icon_settings.png             
HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Accept: image/webp,*/*;q=0.8
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/30.0.1599.66 Safari/537.36
Referer: http://localhost:8080/apps/services/preview/MobileOPMClient/common/0/default/MobileOPMClient.html
Accept-Encoding: gzip,deflate,sdch
Accept-Language: en-US,en;q=0.8,de;q=0.6
Cookie: JSESSIONID=1e1fig7holfdpeuc46w6jmrph; testcookie=oreo

Why is there no line

MyCustomHeader: abcdefgh

Background: I would like to allow local caching of javascript-files to debug them in chrome.

spyro


回答1:


Global headers are added for requests made by WL client API, for example WL.Client.connect(), WL.Client.invokeProcedure() etc.



来源:https://stackoverflow.com/questions/19272022/worklight-wl-client-addglobalheader-has-no-effect

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!