mirror of
https://github.com/morten-olsen/http.md.git
synced 2026-02-08 00:46:28 +01:00
docs: improved docs
This commit is contained in:
@@ -10,6 +10,7 @@ type Response = {
|
||||
statusText: string;
|
||||
headers: Record<string, string>;
|
||||
body?: string;
|
||||
rawBody?: string;
|
||||
};
|
||||
|
||||
type AddRequestOptios = {
|
||||
|
||||
@@ -59,7 +59,8 @@ const httpHandler: ExecutionHandler = ({
|
||||
body
|
||||
});
|
||||
|
||||
let responseText = await response.text();
|
||||
const rawBody = await response.text();
|
||||
let responseText = rawBody;
|
||||
if (options.json) {
|
||||
try {
|
||||
responseText = JSON.parse(responseText);
|
||||
@@ -84,6 +85,7 @@ const httpHandler: ExecutionHandler = ({
|
||||
statusText: response.statusText,
|
||||
headers: Object.fromEntries(response.headers.entries()),
|
||||
body: responseText,
|
||||
rawBody: rawBody,
|
||||
},
|
||||
});
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user