@xrystal/core 3.26.1 → 3.26.2
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
CHANGED
|
@@ -20,14 +20,15 @@ export class BaseController {
|
|
|
20
20
|
const ctx = store?.ctx || {};
|
|
21
21
|
const req = store?.req || {};
|
|
22
22
|
const identityT = (k) => k;
|
|
23
|
-
// Önce store içindeki parse edilmiş veriye bak, yoksa orijinaline git
|
|
24
23
|
const body = store?.metadata?._parsedBody || ctx.body || req.body || ctx.request?.body || {};
|
|
25
24
|
let query = store?.metadata?._parsedQuery || ctx.query || req.query || ctx.request?.query || {};
|
|
26
|
-
const urlStr = ctx.url || req.url || ctx.
|
|
27
|
-
if ((!query || Object.keys(query).length === 0) && typeof urlStr === 'string'
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
const urlStr = ctx.request?.url || req.url || ctx.url || '';
|
|
26
|
+
if ((!query || Object.keys(query).length === 0) && urlStr && typeof urlStr === 'string') {
|
|
27
|
+
if (urlStr.includes('?')) {
|
|
28
|
+
const queryString = urlStr.split('?')[1];
|
|
29
|
+
if (queryString)
|
|
30
|
+
query = qs.parse(queryString);
|
|
31
|
+
}
|
|
31
32
|
}
|
|
32
33
|
const params = {
|
|
33
34
|
...(req.params || {}),
|
|
@@ -189,14 +190,11 @@ export default class Controller extends BaseController {
|
|
|
189
190
|
if (parsedBody && typeof parsedBody === 'object' && parsedBody.constructor?.name === 'FormData') {
|
|
190
191
|
parsedBody = Object.fromEntries(parsedBody.entries());
|
|
191
192
|
}
|
|
192
|
-
const finalBody = parsedBody || {};
|
|
193
|
-
const finalQuery = parsedQuery || {};
|
|
194
|
-
// readonly hatasını önlemek için asıl objeyi değil metadata'yı güncelliyoruz
|
|
195
193
|
if (store) {
|
|
196
194
|
if (!store.metadata)
|
|
197
195
|
store.metadata = { locals: {} };
|
|
198
|
-
store.metadata._parsedBody =
|
|
199
|
-
store.metadata._parsedQuery =
|
|
196
|
+
store.metadata._parsedBody = parsedBody || {};
|
|
197
|
+
store.metadata._parsedQuery = parsedQuery || {};
|
|
200
198
|
}
|
|
201
199
|
const currentReq = this.req;
|
|
202
200
|
const p = { req: currentReq, res: currentRes, body: currentReq.body, query: currentReq.query, params: currentReq.params, t: currentReq.t, accounts: currentReq.accounts };
|