We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a6f8ba8 commit 826ae9bCopy full SHA for 826ae9b
doc/api/http.md
@@ -2831,7 +2831,9 @@ class. The `ClientRequest` instance is a writable stream. If one needs to
2831
upload a file with a POST request, then write to the `ClientRequest` object.
2832
2833
```js
2834
-const postData = querystring.stringify({
+const http = require('http');
2835
+
2836
+const postData = JSON.stringify({
2837
'msg': 'Hello World!'
2838
});
2839
@@ -2841,7 +2843,7 @@ const options = {
2841
2843
path: '/upload',
2842
2844
method: 'POST',
2845
headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
2846
+ 'Content-Type': 'application/json',
2847
'Content-Length': Buffer.byteLength(postData)
2848
}
2849
};
0 commit comments