@trenskow/app 0.5.5 → 0.5.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/lib/application.js +11 -9
- package/package.json +1 -1
package/lib/application.js
CHANGED
|
@@ -173,10 +173,13 @@ export default class Application extends EventEmitter {
|
|
|
173
173
|
|
|
174
174
|
if (path.substr(-1) === '/') path = path.slice(0, -1);
|
|
175
175
|
|
|
176
|
-
query = Object.fromEntries(query
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
176
|
+
query = Object.fromEntries(query
|
|
177
|
+
.split(/&/)
|
|
178
|
+
.filter((entry) => entry)
|
|
179
|
+
.map((entry) => {
|
|
180
|
+
const [key, value] = entry.split(/=/).map(decodeURIComponent);
|
|
181
|
+
return [caseit(key), value];
|
|
182
|
+
}));
|
|
180
183
|
|
|
181
184
|
let state = 'routing';
|
|
182
185
|
|
|
@@ -243,10 +246,7 @@ export default class Application extends EventEmitter {
|
|
|
243
246
|
|
|
244
247
|
}
|
|
245
248
|
},
|
|
246
|
-
query
|
|
247
|
-
get: (target, property) => target[caseit(property)],
|
|
248
|
-
set: (target, property, value) => target[caseit(property)] = value
|
|
249
|
-
}),
|
|
249
|
+
query,
|
|
250
250
|
render: () => {
|
|
251
251
|
state = 'rendering';
|
|
252
252
|
},
|
|
@@ -321,7 +321,9 @@ export default class Application extends EventEmitter {
|
|
|
321
321
|
});
|
|
322
322
|
});
|
|
323
323
|
|
|
324
|
-
context.response.statusCode
|
|
324
|
+
if (context.response.statusCode === 200) {
|
|
325
|
+
context.response.statusCode = context.result ? 200 : 204;
|
|
326
|
+
}
|
|
325
327
|
|
|
326
328
|
} catch (error) {
|
|
327
329
|
|