@aeriajs/common 0.0.163 → 0.0.165
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/dist/http.js +9 -1
- package/package.json +4 -4
package/dist/http.js
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
export const defaultRequestTransformer = async (context) => {
|
|
2
|
+
if (typeof context.url === 'string') {
|
|
3
|
+
context.url = new URL(context.url);
|
|
4
|
+
}
|
|
2
5
|
if (context.payload) {
|
|
3
6
|
if (context.params.method === 'GET' || context.params.method === 'HEAD') {
|
|
4
|
-
|
|
7
|
+
for (const key in context.payload) {
|
|
8
|
+
const value = context.payload[key];
|
|
9
|
+
if (value !== undefined) {
|
|
10
|
+
context.url.searchParams.append(key, String(value));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
5
13
|
}
|
|
6
14
|
else {
|
|
7
15
|
context.params.body = context.params.headers?.['content-type']?.startsWith('application/json')
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aeriajs/common",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.165",
|
|
5
5
|
"description": "",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@aeriajs/types": "link:../types",
|
|
29
|
-
"bson": "^
|
|
29
|
+
"bson": "^7.2.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@aeriajs/types": "^0.0.
|
|
33
|
-
"bson": "^
|
|
32
|
+
"@aeriajs/types": "^0.0.139",
|
|
33
|
+
"bson": "^7.2.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"test": "vitest run",
|