@odatnurd/cf-requests 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/aegis/index.js +8 -5
  2. package/package.json +1 -1
package/aegis/index.js CHANGED
@@ -26,7 +26,7 @@ export function initializeRequestChecks() {
26
26
  );
27
27
 
28
28
  addCheck.value.isResponseWithStatus(
29
- (source, status) => source instanceof Response && source.status == status
29
+ (source, status) => source instanceof Response && source.status === status
30
30
  );
31
31
  }
32
32
 
@@ -78,14 +78,17 @@ export async function schemaTest(dataType, schema, data, validator) {
78
78
  param: () => data,
79
79
  json: async () => data,
80
80
  query: () => data,
81
+ header: () => data,
82
+ cookie: () => data,
83
+ form: async () => data,
81
84
 
82
85
  // The validator invokes this to get headers out of the request when the
83
86
  // data type is JSON.
84
87
  header: (name) => {
85
- if (name.toLowerCase() === 'content-type' && dataType === 'json') {
86
- return 'application/json';
87
- }
88
- return undefined;
88
+ return name.toLowerCase() !== 'content-type' ? undefined : {
89
+ json: 'application/json',
90
+ form: 'multipart/form-data',
91
+ }[dataType];
89
92
  },
90
93
 
91
94
  // When validation succeeds, it invokes this to store the data back into
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@odatnurd/cf-requests",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Simple Cloudflare Hono request wrapper",
5
5
  "author": "OdatNurd (https://odatnurd.net)",
6
6
  "homepage": "https://github.com/OdatNurd/cf-requests",