Commit 2812226576414f49ca5875ddaefff5b1b79af5f6

Authored by Adhidarma Hadiwinoto
1 parent 78957fb644
Exists in master

PULL-TASK: config.pull_task_use_post

Showing 1 changed file with 20 additions and 10 deletions Side-by-side Diff

... ... @@ -89,21 +89,31 @@ function pullTask() {
89 89 }
90 90 pullTaskLocked = true;
91 91  
  92 + const body_or_qs = {
  93 + handler: config.handler_name,
  94 + products: config.products.join(','),
  95 + advice_url: (config && config.push_server && config.push_server.apikey && config.push_server.advice && config.push_server.advice.url && config.push_server.advice.port) ? config.push_server.advice.url : null,
  96 + api_url: (config && config.apiserver && config.apiserver.apikey && config.apiserver.url) ? config.apiserver.url : null,
  97 + cp_url: (config && config.control_panel && config.control_panel.url) ? config.control_panel.url : null,
  98 + komodosdk_type: matrix.komodosdk_type,
  99 + komodosdk_version: matrix.komodosdk_version
  100 + };
  101 +
92 102 let options = {
93 103 url: core_pull_task_url,
94   - qs: {
95   - handler: config.handler_name,
96   - products: config.products.join(','),
97   - advice_url: (config && config.push_server && config.push_server.apikey && config.push_server.advice && config.push_server.advice.url && config.push_server.advice.port) ? config.push_server.advice.url : null,
98   - api_url: (config && config.apiserver && config.apiserver.apikey && config.apiserver.url) ? config.apiserver.url : null,
99   - cp_url: (config && config.control_panel && config.control_panel.url) ? config.control_panel.url : null,
100   - komodosdk_type: matrix.komodosdk_type,
101   - komodosdk_version: matrix.komodosdk_version
102   - }
  104 + }
  105 +
  106 + if (config.pull_task_use_post) {
  107 + options.method = 'POST';
  108 + options.form = body_or_qs;
  109 + }
  110 + else {
  111 + options.method = 'GET';
  112 + options.qs = body_or_qs;
103 113 }
104 114  
105 115 if (config && config.debug_request_task_to_core) {
106   - logger.verbose('Requesting task to CORE', {url: options.url, qs: options.qs});
  116 + logger.verbose('Requesting task to CORE', {url: options.url, method: options.method, body_or_qs: body_or_qs});
107 117 }
108 118  
109 119 const start_time = new Date();