mirror of
https://github.com/nodejs/node.git
synced 2026-11-24 21:50:36 -05:00
doc: add example for test structure
PR-URL: https://github.com/nodejs/node/pull/35046 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
This commit is contained in:
1 parent
9b9a1801ba
commit
e55d3d0953
1 file changed
+15
@@ -109,6 +109,21 @@ case, `_`, lower case).
|
||||
|
||||
### **Lines 11-22**
|
||||
|
||||
```js
|
||||
const server = http.createServer(common.mustCall((req, res) => {
|
||||
res.end('ok');
|
||||
}));
|
||||
server.listen(0, () => {
|
||||
http.get({
|
||||
port: server.address().port,
|
||||
headers: { 'Test': 'Düsseldorf' }
|
||||
}, common.mustCall((res) => {
|
||||
assert.strictEqual(res.statusCode, 200);
|
||||
server.close();
|
||||
}));
|
||||
});
|
||||
```
|
||||
|
||||
This is the body of the test. This test is simple, it just tests that an
|
||||
HTTP server accepts `non-ASCII` characters in the headers of an incoming
|
||||
request. Interesting things to notice:
|
||||
|
||||
Reference in new issue
Block a user