Skip to content

Commit

Permalink
doc: add example for test structure
Browse files Browse the repository at this point in the history
PR-URL: #35046
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
  • Loading branch information
wjabbour authored and targos committed May 1, 2021
1 parent 8099bfb commit 26ec20a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/guides/writing-tests.md
Expand Up @@ -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:
Expand Down

0 comments on commit 26ec20a

Please sign in to comment.