diff --git a/doc/api/http.md b/doc/api/http.md index d492e7ef67277c..1df8bc6a48ccc8 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2831,7 +2831,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!' }); @@ -2841,7 +2843,7 @@ const options = { path: '/upload', method: 'POST', headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } };