Compare View

switch
from
...
to
 
Commits (2)

Changes

Showing 4 changed files Side-by-side Diff

lib/hit/dump-req-res.js
... ... @@ -53,7 +53,11 @@ ${
53 53 )
54 54 }
55 55  
56   -${httpMethod === 'GET' ? `FULL URL: ${endpointUrl}?${querystring.stringify(params)}` : `FORM DATA: ${new URLSearchParams(params).toString()}`}
  56 +${
  57 + (httpMethod === 'GET' && `FULL URL: ${endpointUrl}?${querystring.stringify(params)}`)
  58 + || (httpMethod === 'POST' && `FORM DATA: ${new URLSearchParams(params).toString()}`)
  59 + || ''
  60 +}
57 61  
58 62 RESPONSE-STATUS: ${responseStatus}
59 63 RESPONSE-BODY:
lib/hit/prepaid-topup.js
... ... @@ -59,20 +59,30 @@ module.exports = async (xid, task) => {
59 59 },
60 60 });
61 61  
62   - const response = config.partner.method === 'POST'
63   - ? await axios.post(endpointUrl, new URLSearchParams(params), {
  62 + let response;
  63 + if (config.partner.method === 'POST') {
  64 + response = await axios.post(endpointUrl, new URLSearchParams(params), {
64 65 headers: {
65 66 'User-Agent': 'KOMODO-GW-HTTPGETX',
66 67 },
67 68 timeout: config.partner.hit_timeout_ms || 60 * 1000,
68   - })
69   - : await axios.get(endpointUrl, {
  69 + });
  70 + } else if (config.partner.method === 'POST-JSON') {
  71 + response = await axios.post(endpointUrl, params, {
  72 + headers: {
  73 + 'User-Agent': 'KOMODO-GW-HTTPGETX',
  74 + },
  75 + timeout: config.partner.hit_timeout_ms || 60 * 1000,
  76 + });
  77 + } else {
  78 + response = await axios.get(endpointUrl, {
70 79 headers: {
71 80 'User-Agent': 'KOMODO-GW-HTTPGETX',
72 81 },
73 82 timeout: config.partner.hit_timeout_ms || 60 * 1000,
74 83 params,
75 84 });
  85 + }
76 86  
77 87 if (!response) {
78 88 const e = new Error(`${MODULE_NAME} 8CF4E04D: Empty response`);
1 1 {
2 2 "name": "komodo-gw-komodo-httpgetx",
3   - "version": "0.3.11",
  3 + "version": "0.3.12",
4 4 "lockfileVersion": 2,
5 5 "requires": true,
6 6 "packages": {
7 7 "": {
8 8 "name": "komodo-gw-komodo-httpgetx",
9   - "version": "0.3.11",
  9 + "version": "0.3.12",
10 10 "license": "ISC",
11 11 "dependencies": {
12 12 "axios": "^1.1.3",
1 1 {
2 2 "name": "komodo-gw-komodo-httpgetx",
3   - "version": "0.3.11",
  3 + "version": "0.3.12",
4 4 "description": "Komodo gateway to KOMODO HTTPGETX",
5 5 "main": "index.js",
6 6 "scripts": {