@trenskow/app 0.7.8 → 0.7.9

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.
@@ -1,10 +1,10 @@
1
1
  //
2
2
  // application.js
3
3
  // @trenskow/app
4
- //
4
+ //
5
5
  // Created by Kristian Trenskow on 2021/11/07
6
6
  // For license see LICENSE.
7
- //
7
+ //
8
8
 
9
9
  import http from 'http';
10
10
  import EventEmitter from 'events';
@@ -179,7 +179,13 @@ export default class Application extends EventEmitter {
179
179
  .split(/&/)
180
180
  .filter((entry) => entry)
181
181
  .map((entry) => {
182
- const [key, value] = entry.split(/=/).map(decodeURIComponent);
182
+ return [entry].concat(entry.split(/=/).map(decodeURIComponent));
183
+ })
184
+ .filter(([_, key]) => key)
185
+ .map(([entry, key, value]) => {
186
+ if (typeof value === 'undefined' || value === '') {
187
+ value = entry.slice(-1) === '=' ? undefined : true;
188
+ }
183
189
  return [caseit(key), value];
184
190
  }));
185
191
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trenskow/app",
3
- "version": "0.7.8",
3
+ "version": "0.7.9",
4
4
  "description": "A small HTTP router.",
5
5
  "type": "module",
6
6
  "main": "index.js",