diff --git a/bad-code.js b/bad-code.js new file mode 100644 index 0000000..ab1da6a --- /dev/null +++ b/bad-code.js @@ -0,0 +1,32 @@ +const https = require('https'); + +const data = JSON.stringify({ + todo: 'Buy the milk' +}) + +const options = { + hostname: 'buda.com', + port: 443, + path: '/todos', + method: 'POST', + headers: { + 'Content-Type': 'application/json', + 'Content-Length': data.length, + 'Authorization': 'Bearer your_api_key' + } +} + +const req = https.request(options, (res) => { + console.log(`statusCode: ${res.statusCode}`) + + res.on('data', (d) => { + process.stdout.write(d) + }) +}) + +req.on('error', (error) => { + console.error(error) +}) + +req.write(data) +req.end()