mirror of
https://github.com/nodejs/node.git
synced 2026-11-21 12:59:16 -05:00
doc: update code example for Windows in stream.md
PR-URL: https://github.com/nodejs/node/pull/13138 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
1 parent
eebc262278
commit
9278ce202a
1 file changed
+5
-5
+5
-5
@@ -134,7 +134,7 @@ const server = http.createServer((req, res) => {
|
||||
res.write(typeof data);
|
||||
res.end();
|
||||
} catch (er) {
|
||||
// uh oh! bad json!
|
||||
// uh oh! bad json!
|
||||
res.statusCode = 400;
|
||||
return res.end(`error: ${er.message}`);
|
||||
}
|
||||
@@ -143,12 +143,12 @@ const server = http.createServer((req, res) => {
|
||||
|
||||
server.listen(1337);
|
||||
|
||||
// $ curl localhost:1337 -d '{}'
|
||||
// $ curl localhost:1337 -d "{}"
|
||||
// object
|
||||
// $ curl localhost:1337 -d '"foo"'
|
||||
// $ curl localhost:1337 -d "\"foo\""
|
||||
// string
|
||||
// $ curl localhost:1337 -d 'not json'
|
||||
// error: Unexpected token o
|
||||
// $ curl localhost:1337 -d "not json"
|
||||
// error: Unexpected token o in JSON at position 1
|
||||
```
|
||||
|
||||
[Writable][] streams (such as `res` in the example) expose methods such as
|
||||
|
||||
Reference in new issue
Block a user