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 46eb417 commit 5a67f15Copy full SHA for 5a67f15
doc/api/http.md
@@ -2898,7 +2898,9 @@ class. The `ClientRequest` instance is a writable stream. If one needs to
2898
upload a file with a POST request, then write to the `ClientRequest` object.
2899
2900
```js
2901
-const postData = querystring.stringify({
+const http = require('http');
2902
+
2903
+const postData = JSON.stringify({
2904
'msg': 'Hello World!'
2905
});
2906
@@ -2908,7 +2910,7 @@ const options = {
2908
2910
path: '/upload',
2909
2911
method: 'POST',
2912
headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
2913
+ 'Content-Type': 'application/json',
2914
'Content-Length': Buffer.byteLength(postData)
2915
}
2916
};
0 commit comments