Skip to content

Commit e55d3d0

Browse files
wjabbourtargos
authored andcommittedFeb 2, 2021
doc: add example for test structure
PR-URL: #35046 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com>
1 parent 9b9a180 commit e55d3d0

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed
 

‎doc/guides/writing-tests.md

+15
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,21 @@ case, `_`, lower case).
109109

110110
### **Lines 11-22**
111111

112+
```js
113+
const server = http.createServer(common.mustCall((req, res) => {
114+
res.end('ok');
115+
}));
116+
server.listen(0, () => {
117+
http.get({
118+
port: server.address().port,
119+
headers: { 'Test': 'Düsseldorf' }
120+
}, common.mustCall((res) => {
121+
assert.strictEqual(res.statusCode, 200);
122+
server.close();
123+
}));
124+
});
125+
```
126+
112127
This is the body of the test. This test is simple, it just tests that an
113128
HTTP server accepts `non-ASCII` characters in the headers of an incoming
114129
request. Interesting things to notice:

0 commit comments

Comments
 (0)