Fix HTTPS signing for POSTS
This commit is contained in:
parent
2964c01841
commit
0035ef4f39
|
@ -2,7 +2,8 @@ const { Errors } = require('./enig_error.js');
|
||||||
|
|
||||||
// deps
|
// deps
|
||||||
const { isString, isObject, truncate } = require('lodash');
|
const { isString, isObject, truncate } = require('lodash');
|
||||||
const { https } = require('follow-redirects');
|
const httpsNoRedirects = require('node:https');
|
||||||
|
const { https: httpsWithRedirects } = require('follow-redirects');
|
||||||
const httpSignature = require('http-signature');
|
const httpSignature = require('http-signature');
|
||||||
const crypto = require('crypto');
|
const crypto = require('crypto');
|
||||||
|
|
||||||
|
@ -78,6 +79,13 @@ function _makeRequest(url, options, cb) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
let https;
|
||||||
|
if (options.method === 'POST' || options.sign) {
|
||||||
|
https = httpsNoRedirects;
|
||||||
|
} else {
|
||||||
|
https = httpsWithRedirects;
|
||||||
|
}
|
||||||
|
|
||||||
const req = https.request(url, options, res => {
|
const req = https.request(url, options, res => {
|
||||||
let body = [];
|
let body = [];
|
||||||
res.on('data', d => {
|
res.on('data', d => {
|
||||||
|
|
Loading…
Reference in New Issue