We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a2da9e2 commit e2f28c8Copy full SHA for e2f28c8
doc/api/http.md
@@ -2892,7 +2892,9 @@ class. The `ClientRequest` instance is a writable stream. If one needs to
2892
upload a file with a POST request, then write to the `ClientRequest` object.
2893
2894
```js
2895
-const postData = querystring.stringify({
+const http = require('http');
2896
+
2897
+const postData = JSON.stringify({
2898
'msg': 'Hello World!'
2899
});
2900
@@ -2902,7 +2904,7 @@ const options = {
2902
2904
path: '/upload',
2903
2905
method: 'POST',
2906
headers: {
- 'Content-Type': 'application/x-www-form-urlencoded',
2907
+ 'Content-Type': 'application/json',
2908
'Content-Length': Buffer.byteLength(postData)
2909
}
2910
};
0 commit comments