Skip to content

Commit e2f28c8

Browse files
todortotevdanielleadams
authored andcommitted
doc: fixup code sample in http.md
PR-URL: #38776 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent a2da9e2 commit e2f28c8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

doc/api/http.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -2892,7 +2892,9 @@ class. The `ClientRequest` instance is a writable stream. If one needs to
28922892
upload a file with a POST request, then write to the `ClientRequest` object.
28932893

28942894
```js
2895-
const postData = querystring.stringify({
2895+
const http = require('http');
2896+
2897+
const postData = JSON.stringify({
28962898
'msg': 'Hello World!'
28972899
});
28982900

@@ -2902,7 +2904,7 @@ const options = {
29022904
path: '/upload',
29032905
method: 'POST',
29042906
headers: {
2905-
'Content-Type': 'application/x-www-form-urlencoded',
2907+
'Content-Type': 'application/json',
29062908
'Content-Length': Buffer.byteLength(postData)
29072909
}
29082910
};

0 commit comments

Comments
 (0)