diff --git a/doc/api/http.md b/doc/api/http.md index 5ec542e9011575..058fd73bdae4b1 100644 --- a/doc/api/http.md +++ b/doc/api/http.md @@ -2898,7 +2898,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!' }); @@ -2908,7 +2910,7 @@ const options = { path: '/upload', method: 'POST', headers: { - 'Content-Type': 'application/x-www-form-urlencoded', + 'Content-Type': 'application/json', 'Content-Length': Buffer.byteLength(postData) } };