@athenna/http 1.6.2 → 1.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/README.md +9 -1
- package/package.json +9 -6
- package/src/Context/Request.js +8 -16
package/README.md
CHANGED
|
@@ -34,4 +34,12 @@
|
|
|
34
34
|
|
|
35
35
|
---
|
|
36
36
|
|
|
37
|
-
|
|
37
|
+
<p align='center'>
|
|
38
|
+
With 💜 by <a href='https://github.com/AthennaIO'>Athenna community</a>
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align='center'>
|
|
42
|
+
<a href='https://github.com/AthennaIO/Http/graphs/contributors'>
|
|
43
|
+
<img src='https://contrib.rocks/image?repo=AthennaIO/Http'/>
|
|
44
|
+
</a>
|
|
45
|
+
</p>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@athenna/http",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.4",
|
|
4
4
|
"description": "The Athenna Http server. Built on top of fastify.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "João Lenon <lenon@athenna.io>",
|
|
@@ -54,10 +54,10 @@
|
|
|
54
54
|
"#tests/*": "./tests/*.js"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@athenna/artisan": "1.4.
|
|
58
|
-
"@athenna/ioc": "1.2.
|
|
59
|
-
"@athenna/logger": "1.2.
|
|
60
|
-
"@secjs/utils": "1.9.
|
|
57
|
+
"@athenna/artisan": "1.4.6",
|
|
58
|
+
"@athenna/ioc": "1.2.4",
|
|
59
|
+
"@athenna/logger": "1.2.9",
|
|
60
|
+
"@secjs/utils": "1.9.9",
|
|
61
61
|
"fastify": "3.27.4",
|
|
62
62
|
"fastify-cors": "6.0.3",
|
|
63
63
|
"fastify-rate-limit": "5.8.0"
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@japa/runner": "2.0.7",
|
|
69
69
|
"@japa/spec-reporter": "1.1.12",
|
|
70
70
|
"c8": "7.11.2",
|
|
71
|
-
"commitizen": "4.2.
|
|
71
|
+
"commitizen": "4.2.5",
|
|
72
72
|
"cross-env": "7.0.3",
|
|
73
73
|
"cz-conventional-changelog": "3.3.0",
|
|
74
74
|
"eslint": "8.14.0",
|
|
@@ -90,6 +90,9 @@
|
|
|
90
90
|
"include": [
|
|
91
91
|
"src/**/*.js"
|
|
92
92
|
],
|
|
93
|
+
"exclude": [
|
|
94
|
+
"src/Exceptions/*.js"
|
|
95
|
+
],
|
|
93
96
|
"reporter": [
|
|
94
97
|
"text-summary",
|
|
95
98
|
"html"
|
package/src/Context/Request.js
CHANGED
|
@@ -85,7 +85,7 @@ export class Request {
|
|
|
85
85
|
* @return {any}
|
|
86
86
|
*/
|
|
87
87
|
get body() {
|
|
88
|
-
return this.#request.body
|
|
88
|
+
return this.#request.body || {}
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/**
|
|
@@ -94,7 +94,7 @@ export class Request {
|
|
|
94
94
|
* @return {any}
|
|
95
95
|
*/
|
|
96
96
|
get params() {
|
|
97
|
-
return this.#request.params
|
|
97
|
+
return this.#request.params || {}
|
|
98
98
|
}
|
|
99
99
|
|
|
100
100
|
/**
|
|
@@ -103,7 +103,7 @@ export class Request {
|
|
|
103
103
|
* @return {any}
|
|
104
104
|
*/
|
|
105
105
|
get queries() {
|
|
106
|
-
return this.#request.query
|
|
106
|
+
return this.#request.query || {}
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
/**
|
|
@@ -112,7 +112,7 @@ export class Request {
|
|
|
112
112
|
* @return {any}
|
|
113
113
|
*/
|
|
114
114
|
get headers() {
|
|
115
|
-
return this.#request.headers
|
|
115
|
+
return this.#request.headers || {}
|
|
116
116
|
}
|
|
117
117
|
|
|
118
118
|
/**
|
|
@@ -123,9 +123,7 @@ export class Request {
|
|
|
123
123
|
* @return {any}
|
|
124
124
|
*/
|
|
125
125
|
param(param, defaultValue) {
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
return params[param] || defaultValue
|
|
126
|
+
return this.params[param] || defaultValue
|
|
129
127
|
}
|
|
130
128
|
|
|
131
129
|
/**
|
|
@@ -136,9 +134,7 @@ export class Request {
|
|
|
136
134
|
* @return {any}
|
|
137
135
|
*/
|
|
138
136
|
query(query, defaultValue) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
return queries[query] || defaultValue
|
|
137
|
+
return this.queries[query] || defaultValue
|
|
142
138
|
}
|
|
143
139
|
|
|
144
140
|
/**
|
|
@@ -149,9 +145,7 @@ export class Request {
|
|
|
149
145
|
* @return {any}
|
|
150
146
|
*/
|
|
151
147
|
header(header, defaultValue) {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
return headers[header] || defaultValue
|
|
148
|
+
return this.headers[header] || defaultValue
|
|
155
149
|
}
|
|
156
150
|
|
|
157
151
|
/**
|
|
@@ -162,9 +156,7 @@ export class Request {
|
|
|
162
156
|
* @return {any}
|
|
163
157
|
*/
|
|
164
158
|
payload(payload, defaultValue) {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
return body[payload] || defaultValue
|
|
159
|
+
return this.body[payload] || defaultValue
|
|
168
160
|
}
|
|
169
161
|
|
|
170
162
|
/**
|