Solution:
Install request-promise
const request = require('request-promise');
var options = {
method: 'POST',
uri: 'http://api.posttestserver.com/post',
"rejectUnauthorized": false,
body: {
some: 'payload'
},
json: true // Automatically stringifies the body to JSON
};
rp(options)
.then(function (parsedBody) {
// POST succeeded...
})
.catch(function (err) {
// POST failed...
});
The point is to add: “rejectUnauthorized”: false
Read More:
- Vue init webpack Error: unable to verify the first certificate
- [Solved] node.js Upload Files Error: Multipart: boundary not found multer
- JS getting ${pageContext.request.contextPath} Get the root path of the project
- request.js?b775:101 Uncaught (in promise) Error: Failed to convert value of type ‘java.lang.String’ to required type ‘java.lang.Long’;
- [Solved] Node.js: Error: connect ECONNREFUSED ::1:3306
- Node.js Error: Cannot find module express [How to Solve]
- node.js yarn Error: SyntaxError: Unexpected string [How to Solve]
- [Solved] Node.js v17 npm run dev Error: opensslErrorStack
- Node.js Error: Error: Cannot find module ‘express‘ [How to Solve]
- Node.js Error: “Error: EBUSY: resource busy or locked, stat“
- [Solved] NPM node ERROR in main..js from Terser ChildProcessWorker.initialize Excaption
- [Weex]Error in creating project NPM: unable to load file D:\program files\nodejs\node_ global\ weex.ps1 Because scripts are not allowed to run on this system.
- [Solved] This dependency was not found: * core-js/modules/es.error.cause.js in ./node_modules/_@babel_runtim
- Solution to some map files in JS folder after Vue packaging (remove the map. JS file)
- If the request parameter is formdata, use the Ajax operation
- JS native implementation Promise.all
- [Solved] Error: ENOENT: no such file or directory, scandir ‘..\node_modules\node-sass\vendor‘
- [Solved] Nuxt Import qrcodejs2.js / QRCode.js Error: document is not defined
- JS uses onerror to automatically catch exceptions
- Solution to build error in Vue project (error in static/JS)/vendor.xxxxx.js from UglifyJs)