doc: (HTTP) http.request(url[, options][, callback]) sample code error #38760
Labels
doc
Issues and PRs related to the documentations.
good first issue
Issues that are suitable for first-time contributors.
📗 API Reference Docs Problem
Location
API Reference DOCS: (HTTP) http.request(url[, options][, callback])
Affected URL(s):
Description
The first sample code in this item throws an error (ReferenceError) regarding two undefined constants. The first one is 'querystring' on line #1 and the second one is 'http' on line #16. Both are undeclared.
Please view attached screenshot
Actually, both errors can be fixed if the aforementioned lines are updated to:
Line #1
const postData = JSON.stringify({
Line #16
const req = require('http').request(options, (res) => {
An alternative fix for Line #16 could also be leaving as it is, but declaring the constant in the beginning of the code:
const http = require('http');
Screenshot
submit a pull request.
The text was updated successfully, but these errors were encountered: