diff --git a/doc/api/http.md b/doc/api/http.md index e93e2a5d1ba323..0f6ab5343de10a 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2892,7 +2892,9 @@ class. The `ClientRequest` instance is a writable stream. If one needs to upload a file with a POST request, then write to the `ClientRequest` object. ```js -const postData = querystring.stringify({ +const http = require('http'); + +const postData = JSON.stringify({ 'msg': 'Hello World!' }); @@ -2902,7 +2904,7 @@ const options = { path: '/upload', method: 'POST', headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } };