@opra/http 1.22.5 → 1.22.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.
Files changed (2) hide show
  1. package/http-handler.js +6 -3
  2. package/package.json +4 -4
package/http-handler.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as process from 'node:process';
2
2
  import typeIs from '@browsery/type-is';
3
- import { BadRequestError, HttpHeaderCodes, HttpStatusCode, InternalServerError, isBlob, isReadableStream, IssueSeverity, MethodNotAllowedError, MimeTypes, OperationResult, OpraException, OpraSchema, safeJsonStringify, } from '@opra/common';
3
+ import { ArrayType, BadRequestError, HttpHeaderCodes, HttpStatusCode, InternalServerError, isBlob, isReadableStream, IssueSeverity, MethodNotAllowedError, MimeTypes, OperationResult, OpraException, OpraSchema, safeJsonStringify, } from '@opra/common';
4
4
  import { kAssetCache } from '@opra/core';
5
5
  import { parse as parseContentType } from 'content-type';
6
6
  import { splitString } from 'fast-tokenizer';
@@ -222,14 +222,17 @@ export class HttpHandler {
222
222
  const decode = getDecoder(prm);
223
223
  let values = searchParams?.getAll(key);
224
224
  const prmName = typeof prm.name === 'string' ? prm.name : key;
225
- if (values?.length && prm.isArray) {
225
+ if (values?.length && (prm.type instanceof ArrayType || prm.isArray)) {
226
226
  values = values
227
227
  .map(v => splitString(v, {
228
228
  delimiters: prm.arraySeparator || ',',
229
229
  quotes: true,
230
230
  }))
231
231
  .flat();
232
- values = values.map(v => decode(v, { coerce: true, label: key, onFail }));
232
+ if (prm.type instanceof ArrayType)
233
+ values = decode(values, { coerce: true, label: key, onFail });
234
+ else
235
+ values = values.map(v => decode(v, { coerce: true, label: key, onFail }));
233
236
  if (prm.parser)
234
237
  values = prm.parser(values);
235
238
  if (values.length)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/http",
3
- "version": "1.22.5",
3
+ "version": "1.22.6",
4
4
  "description": "Opra Http Server Adapter",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -31,12 +31,12 @@
31
31
  "reflect-metadata": "^0.2.2",
32
32
  "super-fast-md5": "^1.0.3",
33
33
  "tslib": "^2.8.1",
34
- "valgen": "^5.18.2",
34
+ "valgen": "^5.19.3",
35
35
  "vary": "^1.1.2"
36
36
  },
37
37
  "peerDependencies": {
38
- "@opra/common": "^1.22.5",
39
- "@opra/core": "^1.22.5"
38
+ "@opra/common": "^1.22.6",
39
+ "@opra/core": "^1.22.6"
40
40
  },
41
41
  "optionalDependencies": {
42
42
  "express": "^4.0.0 || ^5.0.0",