场景说明示例_document.md 1.4 KB

开发背景

  • 灰度控制需求、流量控制需求、用户行为分析需求
  • 跨域访问需求
  • 模拟设备请求需要

适用场景

javascript应用,用于为chrome中的web应用添加http header请求头

使用要求

环境限制

  1. 支持chrome内核的浏览器

案例

使用示例:

  1. 通过websocket方式读取获取header配置

发送获取config请求到ws://127.0.0.1:9002

{"messageType":131073}

返回对应的config信息

{
   "debug_mode" : true,
   "format_version" : "1.1",
   "headers" : [
      {
         "action" : "add",
         "apply_on" : "req",
         "comment" : "test",
         "header_name" : "VTM_terminalno",
         "header_value" : "7555980277",
         "status" : "on",
         "url_contains" : ""
      }
   ],
   "target_page" : "",
   "use_url_contains" : false
}
  1. 通过本地文件的方式读取获取header配置 在mainfest.json中配置对应配置文件路径

    "permissions": [
    "storage",
    "webRequest",
    "webRequestBlocking",
    "<all_urls>",
    "file:///D:/Run/runinfo/runcfg/config.json"
    ],
    

3、通过命令行方式附加打开插件(也可以通过商店、chrome内安装等各种形式) C:\Program Files\Google\Chrome\Application\chrome.exe --load-extension=D:\addin\res\VTMModifyHeaders