keq 2.6.3 → 2.6.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,13 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
4
4
 
5
+ ## [2.6.4](https://github.com/keq-request/keq/compare/v2.6.3...v2.6.4) (2024-06-02)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * cannot find Buffer at browser ([c165673](https://github.com/keq-request/keq/commit/c16567394000a0659dfb76fdac314a1b54ef0bfd))
11
+
5
12
  ## [2.6.3](https://github.com/keq-request/keq/compare/v2.6.2...v2.6.3) (2024-05-30)
6
13
 
7
14
 
@@ -13,7 +13,7 @@ export type { KeqRoute } from './types/keq-route.js';
13
13
  export type { KeqGlobal } from './types/keq-global.js';
14
14
  export type { KeqEvents } from './types/keq-events.js';
15
15
  export type { KeqRetryOn, KeqRetryDelay } from './types/keq-retry.js';
16
- export type { KeqOperations, KeqBaseOperation } from './types/keq-operation.js';
16
+ export type { KeqOperations, KeqOperation, KeqBaseOperation } from './types/keq-operation.js';
17
17
  export { keqHostRoute } from './router/keq-host-route.js';
18
18
  export { keqLocationRoute } from './router/keq-location-route.js';
19
19
  export { keqMethodRoute } from './router/keq-method-route.js';
@@ -2,6 +2,7 @@ import { URL } from 'whatwg-url';
2
2
  import { Exception } from "../exception/exception.js";
3
3
  import { compilePathnameTemplate } from "../util/compile-pathname-template.js";
4
4
  import { ABORT_PROPERTY } from "../constant.js";
5
+ import { isBrowser } from "../is/is-browser.js";
5
6
  function compileUrl(obj, routeParams) {
6
7
  const url = new URL(typeof obj === 'string' ? obj : obj.href);
7
8
  try {
@@ -63,7 +64,7 @@ function compileBody(ctx) {
63
64
  request.headers.delete('content-type');
64
65
  return form;
65
66
  }
66
- if (body instanceof Buffer)
67
+ if (!isBrowser() && body instanceof Buffer)
67
68
  return body;
68
69
  if (body === undefined)
69
70
  return body;
@@ -13,7 +13,7 @@ export class KeqRouter {
13
13
  if (middlewares.length === 0)
14
14
  return this;
15
15
  const m = middlewares.length > 1 ? composeMiddleware(middlewares) : middlewares[0];
16
- this.prependMiddlewares.push(async (ctx, next) => {
16
+ this.prependMiddlewares.push(async function router(ctx, next) {
17
17
  if (route(ctx))
18
18
  await m(ctx, next);
19
19
  else
@@ -3,10 +3,10 @@ import { ExtractProperty } from './extract-property.js';
3
3
  import { KeqContextRequestMethod } from './keq-context-request.js';
4
4
  export interface KeqOperation {
5
5
  requestParams: {
6
- [key: string]: string;
6
+ [key: string]: string | number;
7
7
  };
8
8
  requestQuery: {
9
- [key: string]: string | string[];
9
+ [key: string]: string | string[] | number;
10
10
  };
11
11
  requestHeaders: {
12
12
  [key: string]: string;
@@ -13,7 +13,7 @@ export type { KeqRoute } from './types/keq-route.js';
13
13
  export type { KeqGlobal } from './types/keq-global.js';
14
14
  export type { KeqEvents } from './types/keq-events.js';
15
15
  export type { KeqRetryOn, KeqRetryDelay } from './types/keq-retry.js';
16
- export type { KeqOperations, KeqBaseOperation } from './types/keq-operation.js';
16
+ export type { KeqOperations, KeqOperation, KeqBaseOperation } from './types/keq-operation.js';
17
17
  export { keqHostRoute } from './router/keq-host-route.js';
18
18
  export { keqLocationRoute } from './router/keq-location-route.js';
19
19
  export { keqMethodRoute } from './router/keq-method-route.js';
@@ -4,7 +4,7 @@
4
4
  if (v !== undefined) module.exports = v;
5
5
  }
6
6
  else if (typeof define === "function" && define.amd) {
7
- define(["require", "exports", "whatwg-url", "../exception/exception.js", "../util/compile-pathname-template.js", "../constant.js"], factory);
7
+ define(["require", "exports", "whatwg-url", "../exception/exception.js", "../util/compile-pathname-template.js", "../constant.js", "../is/is-browser.js"], factory);
8
8
  }
9
9
  })(function (require, exports) {
10
10
  "use strict";
@@ -14,6 +14,7 @@
14
14
  const exception_js_1 = require("../exception/exception.js");
15
15
  const compile_pathname_template_js_1 = require("../util/compile-pathname-template.js");
16
16
  const constant_js_1 = require("../constant.js");
17
+ const is_browser_js_1 = require("../is/is-browser.js");
17
18
  function compileUrl(obj, routeParams) {
18
19
  const url = new whatwg_url_1.URL(typeof obj === 'string' ? obj : obj.href);
19
20
  try {
@@ -75,7 +76,7 @@
75
76
  request.headers.delete('content-type');
76
77
  return form;
77
78
  }
78
- if (body instanceof Buffer)
79
+ if (!(0, is_browser_js_1.isBrowser)() && body instanceof Buffer)
79
80
  return body;
80
81
  if (body === undefined)
81
82
  return body;
@@ -25,7 +25,7 @@
25
25
  if (middlewares.length === 0)
26
26
  return this;
27
27
  const m = middlewares.length > 1 ? (0, compose_middleware_js_1.composeMiddleware)(middlewares) : middlewares[0];
28
- this.prependMiddlewares.push(async (ctx, next) => {
28
+ this.prependMiddlewares.push(async function router(ctx, next) {
29
29
  if (route(ctx))
30
30
  await m(ctx, next);
31
31
  else
@@ -3,10 +3,10 @@ import { ExtractProperty } from './extract-property.js';
3
3
  import { KeqContextRequestMethod } from './keq-context-request.js';
4
4
  export interface KeqOperation {
5
5
  requestParams: {
6
- [key: string]: string;
6
+ [key: string]: string | number;
7
7
  };
8
8
  requestQuery: {
9
- [key: string]: string | string[];
9
+ [key: string]: string | string[] | number;
10
10
  };
11
11
  requestHeaders: {
12
12
  [key: string]: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "keq",
3
- "version": "2.6.3",
3
+ "version": "2.6.4",
4
4
  "description": "Request API write by Typescript for flexibility, readability, and a low learning curve.",
5
5
  "keywords": [
6
6
  "request",