Browse Source

fix: missing 'body' key in RequestContext type

e22m4u 1 year ago
parent
commit
4e0ac76f61
5 changed files with 20 additions and 13 deletions
  1. 1 0
      README-ru.md
  2. 1 0
      README.md
  3. 6 6
      dist/cjs/index.cjs
  4. 5 0
      src/request-context.d.ts
  5. 7 7
      src/request-context.js

+ 1 - 0
README-ru.md

@@ -75,6 +75,7 @@ server.listen(3000, 'localhost');             // прослушивание за
 - `method: string` метод запроса в верхнем регистре, например `GET`, `POST` и т.д.
 - `method: string` метод запроса в верхнем регистре, например `GET`, `POST` и т.д.
 - `path: string` путь включающий строку запроса, например `/myPath?foo=bar`
 - `path: string` путь включающий строку запроса, например `/myPath?foo=bar`
 - `pathname: string` путь запроса, например `/myMath`
 - `pathname: string` путь запроса, например `/myMath`
+- `body: unknown` тело запроса
 
 
 Пример доступа к контексту из обработчика маршрута.
 Пример доступа к контексту из обработчика маршрута.
 
 

+ 1 - 0
README.md

@@ -75,6 +75,7 @@ set with contents of a parsed incoming request.
 - `method: string` request method in uppercase, e.g. `GET`, `POST`, etc.
 - `method: string` request method in uppercase, e.g. `GET`, `POST`, etc.
 - `path: string` path including query string, e.g. `/myPath?foo=bar`
 - `path: string` path including query string, e.g. `/myPath?foo=bar`
 - `pathname: string` request path, e.g. `/myMath`
 - `pathname: string` request path, e.g. `/myMath`
+- `body: unknown` request body
 
 
 Example of accessing the context from a route handler.
 Example of accessing the context from a route handler.
 
 

+ 6 - 6
dist/cjs/index.cjs

@@ -3410,12 +3410,6 @@ var RequestContext = class {
    * @type {object}
    * @type {object}
    */
    */
   params = {};
   params = {};
-  /**
-   * Parsed body.
-   *
-   * @type {*}
-   */
-  body;
   /**
   /**
    * Headers.
    * Headers.
    *
    *
@@ -3428,6 +3422,12 @@ var RequestContext = class {
    * @type {object}
    * @type {object}
    */
    */
   cookie = {};
   cookie = {};
+  /**
+   * Parsed body.
+   *
+   * @type {*}
+   */
+  body;
   /**
   /**
    * Method.
    * Method.
    *
    *

+ 5 - 0
src/request-context.d.ts

@@ -51,6 +51,11 @@ export declare class RequestContext {
    */
    */
   cookie: ParsedCookie;
   cookie: ParsedCookie;
 
 
+  /**
+   * Body.
+   */
+  body: unknown;
+
   /**
   /**
    * Method.
    * Method.
    */
    */

+ 7 - 7
src/request-context.js

@@ -43,13 +43,6 @@ export class RequestContext {
    */
    */
   params = {};
   params = {};
 
 
-  /**
-   * Parsed body.
-   *
-   * @type {*}
-   */
-  body;
-
   /**
   /**
    * Headers.
    * Headers.
    *
    *
@@ -64,6 +57,13 @@ export class RequestContext {
    */
    */
   cookie = {};
   cookie = {};
 
 
+  /**
+   * Parsed body.
+   *
+   * @type {*}
+   */
+  body;
+
   /**
   /**
    * Method.
    * Method.
    *
    *