@felloh-org/lambda-wrapper 1.11.57 → 1.11.58
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/dist/service/request.js +8 -2
- package/package.json +1 -1
package/dist/service/request.js
CHANGED
|
@@ -154,6 +154,7 @@ class Request extends _dependencyAware.default {
|
|
|
154
154
|
|
|
155
155
|
getAll(requestType = null) {
|
|
156
156
|
const event = this.getContainer().getEvent();
|
|
157
|
+
console.log('raw event', event);
|
|
157
158
|
|
|
158
159
|
if (HTTP_METHODS_WITHOUT_PAYLOADS.includes(event.httpMethod) || HTTP_METHODS_WITHOUT_PAYLOADS.includes(requestType)) {
|
|
159
160
|
// get simple parameters
|
|
@@ -169,11 +170,14 @@ class Request extends _dependencyAware.default {
|
|
|
169
170
|
if (HTTP_METHODS_WITH_PAYLOADS.includes(event.httpMethod) || HTTP_METHODS_WITH_PAYLOADS.includes(requestType)) {
|
|
170
171
|
const contentType = this.getHeader('Content-Type', this.getHeader('content-type'));
|
|
171
172
|
let queryParameters = {};
|
|
173
|
+
console.log('content-type', contentType);
|
|
172
174
|
|
|
173
175
|
if (contentType.includes('application/x-www-form-urlencoded')) {
|
|
174
176
|
queryParameters = _querystring.default.parse(event.body);
|
|
175
177
|
}
|
|
176
178
|
|
|
179
|
+
console.log('event body', typeof event.body);
|
|
180
|
+
|
|
177
181
|
if (contentType.includes('application/json')) {
|
|
178
182
|
try {
|
|
179
183
|
if (typeof event.body) {
|
|
@@ -182,7 +186,7 @@ class Request extends _dependencyAware.default {
|
|
|
182
186
|
queryParameters = JSON.parse(event.body);
|
|
183
187
|
}
|
|
184
188
|
} catch (error) {
|
|
185
|
-
console.log(error);
|
|
189
|
+
console.log('application/json parse error', error);
|
|
186
190
|
queryParameters = {};
|
|
187
191
|
}
|
|
188
192
|
}
|
|
@@ -197,7 +201,8 @@ class Request extends _dependencyAware.default {
|
|
|
197
201
|
queryParameters = this.parseForm(true);
|
|
198
202
|
}
|
|
199
203
|
|
|
200
|
-
|
|
204
|
+
console.log(queryParameters);
|
|
205
|
+
return queryParameters;
|
|
201
206
|
}
|
|
202
207
|
|
|
203
208
|
return null;
|
|
@@ -264,6 +269,7 @@ class Request extends _dependencyAware.default {
|
|
|
264
269
|
if (typeof validation === 'undefined') {
|
|
265
270
|
resolve();
|
|
266
271
|
} else {
|
|
272
|
+
console.log(this.getAll(), validation);
|
|
267
273
|
Logger.label('request-validation-failed');
|
|
268
274
|
const validationErrorResponse = new _response.default({}, 422);
|
|
269
275
|
Object.keys(validation).forEach(validationKey => {
|