Skip to content

Commit

Permalink
doc: fixup code sample in http.md
Browse files Browse the repository at this point in the history
PR-URL: #38776
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
todortotev authored and danielleadams committed May 31, 2021
1 parent a2da9e2 commit e2f28c8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions doc/api/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!'
});

Expand All @@ -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)
}
};
Expand Down

0 comments on commit e2f28c8

Please sign in to comment.