From 6eb3f8e841b3880b372ef628825b1b3e7211dc31 Mon Sep 17 00:00:00 2001 From: Luke Childs Date: Tue, 29 May 2018 13:04:33 +0700 Subject: [PATCH] Document body parsing --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index ab51bf7..9f9c591 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,13 @@ createTestServer().then(server => { }); ``` +The following `Content-Type` headers will be parsed and exposed via `req.body`: + +- JSON (`application/json`) +- Text (`text/plain`) +- URL-encoded form (`application/x-www-form-urlencoded`) +- Buffer (`application/octet-stream`) + `createTestServer()` has a Promise based API that pairs well with a modern asynchronous test runner such as [AVA](https://github.com/avajs/ava). You can create a separate server per test: