Commit cee96410a35b8ef01e0cb73099c37747f0419822
1 parent
ad9e196970
Exists in
master
parsing querystring pada reverse
Showing 1 changed file with 10 additions and 6 deletions Side-by-side Diff
partner-simplepay.js
... | ... | @@ -5,6 +5,8 @@ process.env.NODE_TLS_REJECT_UNAUTHORIZED = "0"; |
5 | 5 | const request = require('request'); |
6 | 6 | const crypto = require('crypto'); |
7 | 7 | const moment = require('moment'); |
8 | +const URL = require('url'); | |
9 | + | |
8 | 10 | |
9 | 11 | const http = require('http'); |
10 | 12 | http.globalAgent.maxSockets = Infinity; |
... | ... | @@ -309,18 +311,20 @@ function reverseReportHandler(body) { |
309 | 311 | } |
310 | 312 | |
311 | 313 | function createReverseHttpServer() { |
312 | - var httpServer = http.createServer(function(request, response) { | |
314 | + var httpServer = http.createServer(function(req, res) { | |
315 | + | |
316 | + const qs = URL.parse(req.url, true).query | |
317 | + logger.info('Got request from partner', {remote_address: remote_ip: req.connection.remoteAddress, qs: qs}); | |
313 | 318 | |
314 | - logger.info('Got request from partner'); | |
315 | 319 | |
316 | 320 | var body = ""; |
317 | - request.on('data', function (chunk) { | |
321 | + req.on('data', function (chunk) { | |
318 | 322 | body += chunk; |
319 | 323 | }); |
320 | 324 | |
321 | - request.on('end', function () { | |
322 | - response.writeHead(200); | |
323 | - response.end('OK'); | |
325 | + req.on('end', function () { | |
326 | + res.writeHead(200); | |
327 | + res.end('OK'); | |
324 | 328 | |
325 | 329 | reverseReportHandler(body); |
326 | 330 | }); |