Я использую запрос NodeJS - упрощенный HTTP-клиент
Кажется, у меня проблемы с работой с HTTPS-сайтом, я не получаю результата.
var request = require('request');
request.post({
url: "",//your url
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
form: {
myfield: "myfieldvalue"
}
},function (response, err, body){
console.log('Body:',JSON.parse(body));
}.bind(this));
Протестировал конечную точку API (которой я не могу поделиться) на Postman, я просто отключил SSL и он работает, как мне сделать то же самое с плагином запросов?
Просто добавьте следующие строки:
rejectUnauthorized: false,//add when working with https sites
requestCert: false,//add when working with https sites
agent: false,//add when working with https sites
Таким образом, ваш код будет выглядеть так:
var request = require('request');
request.post({
url: "",//your url
headers: {
'Content-Type': 'application/x-www-form-urlencoded'
},
rejectUnauthorized: false,//add when working with https sites
requestCert: false,//add when working with https sites
agent: false,//add when working with https sites
form: {
myfield: "myfieldvalue"
}
},function (response, err, body){
console.log('Body:',JSON.parse(body));
}.bind(this));