Skip to content

Instantly share code, notes, and snippets.

@diogenesjup
Created March 15, 2022 23:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save diogenesjup/f243ca6b46a6a6fa107e4f247457abb1 to your computer and use it in GitHub Desktop.
Save diogenesjup/f243ca6b46a6a6fa107e4f247457abb1 to your computer and use it in GitHub Desktop.
var https = require('follow-redirects').https;
var fs = require('fs');
var qs = require('querystring');
var options = {
'method': 'POST',
'hostname': 'servidorseguro.cloud',
'path': '/istpay/cobranca/atualizar/2',
'headers': {
'Content-Type': 'application/x-www-form-urlencoded'
},
'maxRedirects': 20
};
var req = https.request(options, function (res) {
var chunks = [];
res.on("data", function (chunk) {
chunks.push(chunk);
});
res.on("end", function (chunk) {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
res.on("error", function (error) {
console.error(error);
});
});
var postData = qs.stringify({
'status': 'PAID',
'data_transaction': '{field:value,field2:value2}'
});
req.write(postData);
req.end();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment