@spinajs/http 1.2.151 → 1.2.160

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.
@@ -15,7 +15,7 @@ let FromBody = class FromBody extends RouteArgs_1.RouteArgs {
15
15
  return interfaces_1.ParameterType.FromBody;
16
16
  }
17
17
  async extract(callData, param, req, _res, route) {
18
- const arg = req.body[param.Name] ? req.body[param.Name] : route.Parameters.size === 1 ? req.body : null;
18
+ const arg = req.body[param.Name] ? req.body[param.Name] : [...route.Parameters.values()].filter((p) => p.Type === interfaces_1.ParameterType.FromBody).length === 1 ? req.body : null;
19
19
  let result = await this.tryHydrateParam(arg, param, route);
20
20
  return { CallData: callData, Args: result };
21
21
  }
@@ -1 +1 @@
1
- {"version":3,"file":"FromBody.js","sourceRoot":"","sources":["../../src/route-args/FromBody.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8CAAmF;AAEnF,oCAAyC;AAGzC,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,qBAAS;IACrC,IAAW,aAAa;QACtB,OAAO,0BAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,QAAoB,EAAE,KAAsB,EAAE,GAAoB,EAAE,IAAsB,EAAE,KAAa;QAC5H,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACxG,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9C,CAAC;CACF,CAAA;AAVY,QAAQ;IADpB,IAAA,eAAU,GAAE;GACA,QAAQ,CAUpB;AAVY,4BAAQ"}
1
+ {"version":3,"file":"FromBody.js","sourceRoot":"","sources":["../../src/route-args/FromBody.ts"],"names":[],"mappings":";;;;;;;;;AAAA,2CAAwC;AACxC,8CAAmF;AAEnF,oCAAyC;AAGzC,IAAa,QAAQ,GAArB,MAAa,QAAS,SAAQ,qBAAS;IACrC,IAAW,aAAa;QACtB,OAAO,0BAAa,CAAC,QAAQ,CAAC;IAChC,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,QAAoB,EAAE,KAAsB,EAAE,GAAoB,EAAE,IAAsB,EAAE,KAAa;QAC5H,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,UAAU,CAAC,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,0BAAa,CAAC,QAAQ,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;QACzK,IAAI,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;IAC9C,CAAC;CACF,CAAA;AAVY,QAAQ;IADpB,IAAA,eAAU,GAAE;GACA,QAAQ,CAUpB;AAVY,4BAAQ"}
Binary file
@@ -0,0 +1,15 @@
1
+ body {
2
+ font-family: "Lucida Console", Monaco, monospace;
3
+ }
4
+
5
+ .container {
6
+ display: flex;
7
+ justify-content: center;
8
+ height: 100%;
9
+ }
10
+
11
+ .container > .item {
12
+ height: 100%;
13
+ display: flex;
14
+ align-items: center;
15
+ }
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Bad request")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 400 - #{__("Bad request")}
13
+ div #{__(message)}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Conflict")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 409 - #{__("Conflict")}
13
+ div #{__(message)}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Forbidden")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 403 - #{__("Forbidden")}
13
+ div #{__(message)}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("No content")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 204 - #{__("No content")}
13
+ div #{__(message)}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Not found")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 404 - #{__("Not found")}
13
+ div #{__(message)}
@@ -0,0 +1,12 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.png")
4
+
5
+ title #{__("All ok")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 200 - #{__("All ok")}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Server error")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 500 - #{__("Server error")}
13
+ div #{__(message)}
@@ -0,0 +1,13 @@
1
+ html
2
+ head
3
+ link(rel="icon", type="image/x-icon", href="/static/favicon.ico")
4
+
5
+ title #{__("Unauthorized")}
6
+
7
+ link(href="/static/style.css",rel="stylesheet")
8
+ body
9
+ div(class="container")
10
+ div(class="item")
11
+ div(class="entry")
12
+ h1 401 - #{__("Unauthorized")}
13
+ div #{__(message)}
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@spinajs/http",
3
- "version": "1.2.151",
3
+ "version": "1.2.160",
4
4
  "description": "framework HTTP module base on express.js",
5
5
  "main": "lib/index.js",
6
6
  "private": false,
7
7
  "scripts": {
8
- "build": "npm run clean && npm run compile",
8
+ "build": "npm run clean && npm run compile && cpx src/views/**/* lib/views && cpx src/static/**/* lib/static",
9
9
  "compile": "tsc -p tsconfig.build.json",
10
10
  "clean": "",
11
11
  "test": "ts-mocha -p tsconfig.json test/**/*.test.ts",
@@ -61,5 +61,5 @@
61
61
  "tempfile": "3.0.0",
62
62
  "uuid": "^8.3.2"
63
63
  },
64
- "gitHead": "6a1358a438161d23d5f076b06bbf43ddcfc12d9f"
64
+ "gitHead": "12a854d49df225b511220b1107577643604f3f54"
65
65
  }