diff --git a/docs/README.md b/docs/README.md
index 62190d9..738be72 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -209,34 +209,18 @@ The requests from the embedded document are processed, and their `request` and `
Assume `_shared_requests.md` contains:
-````markdown
-```http id=sharedGetRequest
-GET https://httpbin.org/get
-```
-````
+::raw-md[./examples/_shared_requests.md]
Then, in `main.md`:
-````markdown
-# Main Document
+::raw-md[./examples/with-shared-requests.md]
-Let's include some shared requests:
+
+ Output
-::md[./_shared_requests.md]
+::raw-md[./examples/with-shared-requests.md]{render}
-The shared GET request returned: {{responses.sharedGetRequest.status}}
-
-Now, a request specific to this document:
-
-```http
-POST https://httpbin.org/post
-Content-Type: application/json
-
-{"dataFromMain": "someValue", "sharedUrl": "{{requests.sharedGetRequest.url}}"}
-```
-
-::response
-````
+
When `main.md` is processed, `_shared_requests.md` will be embedded, its `sharedGetRequest` will be executed, and its data will be available for templating.
diff --git a/docs/examples/_shared_requests.md b/docs/examples/_shared_requests.md
new file mode 100644
index 0000000..e806fd3
--- /dev/null
+++ b/docs/examples/_shared_requests.md
@@ -0,0 +1,3 @@
+```http #sharedGetRequest
+GET https://httpbin.org/get
+```
diff --git a/docs/examples/with-shared-requests.md b/docs/examples/with-shared-requests.md
new file mode 100644
index 0000000..488f96b
--- /dev/null
+++ b/docs/examples/with-shared-requests.md
@@ -0,0 +1,18 @@
+# Main Document
+
+Let's include some shared requests:
+
+::md[./_shared_requests.md]
+
+The shared GET request returned: {{response.statusText}}
+
+Now, a request specific to this document:
+
+```http
+POST https://httpbin.org/post
+Content-Type: application/json
+
+{"dataFromMain": "someValue", "sharedUrl": "{{requests.sharedGetRequest.url}}"}
+```
+
+::response
diff --git a/src/context/context.ts b/src/context/context.ts
index 81c60f4..d7ccdec 100644
--- a/src/context/context.ts
+++ b/src/context/context.ts
@@ -10,6 +10,7 @@ type Response = {
statusText: string;
headers: Record;
body?: string;
+ rawBody?: string;
};
type AddRequestOptios = {
diff --git a/src/execution/handlers/handlers.http.ts b/src/execution/handlers/handlers.http.ts
index 3c371b7..ba41861 100644
--- a/src/execution/handlers/handlers.http.ts
+++ b/src/execution/handlers/handlers.http.ts
@@ -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,
},
});
},