From d4d0a7486f33a3e95556fa4888634cbc3d044e96 Mon Sep 17 00:00:00 2001 From: Jeremy Forsythe Date: Mon, 1 Mar 2021 20:25:04 -0500 Subject: [PATCH] Fix response body type for parse: none Fixes # 62 Fix response body type for parse: none to be Buffer Add parse: string to explicitly ask for body as a string Add types for string parsing Add tests for Buffer and string bodies Regenerate documentation --- docs/global.html | 4 ++-- docs/index.html | 33 ++++++++++++++------------------- docs/phin.js.html | 34 ++++++++++++++++++++++++++-------- lib/phin.js | 20 ++++++++++++++------ tests/test.js | 38 ++++++++++++++++++++++++++++++++++++++ types.d.ts | 22 +++++++++++++++++++++- 6 files changed, 115 insertions(+), 36 deletions(-) diff --git a/docs/global.html b/docs/global.html index 90874c8..7296c3e 100644 --- a/docs/global.html +++ b/docs/global.html @@ -565,7 +565,7 @@
Properties:
- Response parsing. Errors will be given if the response can't be parsed. ('none', 'json') + Response parsing. Errors will be given if the response can't be parsed. 'none' returns body as a `Buffer`, 'json' attempts to parse the body as JSON, and 'string' attempts to parse the body as a string @@ -1084,7 +1084,7 @@

Home

Global