primate 0.27.5 → 0.27.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/hooks/parse.js +3 -7
package/package.json
CHANGED
package/src/hooks/parse.js
CHANGED
|
@@ -6,10 +6,8 @@ import errors from "../errors.js";
|
|
|
6
6
|
const deslash = url => url.replaceAll(/(?<!http:)\/{2,}/gu, _ => "/");
|
|
7
7
|
|
|
8
8
|
const parse_body = (body, headers, url) =>
|
|
9
|
-
tryreturn(async _ => {
|
|
10
|
-
|
|
11
|
-
return Body.parse(body, headers.get("content-type")) ?? {};
|
|
12
|
-
}).orelse(error => errors.MismatchedBody.throw(url.pathname, error.message));
|
|
9
|
+
tryreturn(async _ => Body.parse(body, headers.get("content-type")) ?? {})
|
|
10
|
+
.orelse(error => errors.MismatchedBody.throw(url.pathname, error.message));
|
|
13
11
|
|
|
14
12
|
export default dispatch => async original => {
|
|
15
13
|
const { headers } = original;
|
|
@@ -17,9 +15,7 @@ export default dispatch => async original => {
|
|
|
17
15
|
const cookies = headers.get("cookie");
|
|
18
16
|
const body = await parse_body(original.body, headers, url);
|
|
19
17
|
|
|
20
|
-
return { original, url, body,
|
|
21
|
-
async_function: async () => "1",
|
|
22
|
-
...valmap({
|
|
18
|
+
return { original, url, body, ...valmap({
|
|
23
19
|
query: [from(url.searchParams), url.search],
|
|
24
20
|
headers: [from(headers), headers, false],
|
|
25
21
|
cookies: [from(cookies?.split(";").map(cookie =>
|