@villedemontreal/http-request 7.4.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.
@@ -0,0 +1,363 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.httpUtils = exports.HttpUtils = void 0;
4
+ const general_utils_1 = require("@villedemontreal/general-utils");
5
+ const http_header_fields_typed_1 = require("http-header-fields-typed");
6
+ const _ = require("lodash");
7
+ const configs_1 = require("./config/configs");
8
+ const constants_1 = require("./config/constants");
9
+ const logger_1 = require("./utils/logger");
10
+ const logger = (0, logger_1.createLogger)('HttpUtils');
11
+ /**
12
+ * HTTP utilities
13
+ */
14
+ class HttpUtils {
15
+ constructor() {
16
+ this.REQ_PARAMS_LOWERCASED = '__queryParamsLowercased';
17
+ /**
18
+ * Get the last value of a querystring parameter *as a Date*.
19
+ * The parameter must be parsable using `new Date(xxx)`.
20
+ * It is recommended to always use ISO-8601 to represent dates
21
+ * (ex: "2020-04-21T17:13:33.107Z").
22
+ *
23
+ * If the parameter is found but can't be parsed to a Date,
24
+ * by default an `Error` is thrown. But if `errorHandler`
25
+ * is specified, it is called instead. This allows you
26
+ * to catch the error and throw a custom error, for
27
+ * example by using `throw createInvalidParameterError(xxx)`
28
+ * in an API.
29
+ *
30
+ * Manages the fact that we may use insensitive routing.
31
+ *
32
+ * @returns the last parameter with that key as a Date
33
+ * or `undefined` if not found.
34
+ * @throws An Error if the parameter is found but can't be parsed
35
+ * to a Date and no `errorHandler` is specified.
36
+ */
37
+ this.getQueryParamOneAsDate = (req, key, errorHandler) => {
38
+ const dateStr = this.getQueryParamOne(req, key);
39
+ let date;
40
+ if (!general_utils_1.utils.isBlank(dateStr)) {
41
+ date = new Date(dateStr);
42
+ if (isNaN(date.getTime())) {
43
+ const errorMsg = `Not a valid parsable date: "${dateStr}"`;
44
+ if (errorHandler) {
45
+ return errorHandler(errorMsg, dateStr);
46
+ }
47
+ throw new Error(errorMsg);
48
+ }
49
+ }
50
+ return date;
51
+ };
52
+ /**
53
+ * Get the last value of a querystring parameter *as a Number*.
54
+ * The parameter must be parsable using `Number(xxx)`.
55
+ *
56
+ * If the parameter is found but can't be parsed to a Number,
57
+ * by default an `Error` is thrown. But if `errorHandler`
58
+ * is specified, it is called instead. This allows you
59
+ * to catch the error and throw a custom error, for
60
+ * example by using `throw createInvalidParameterError(xxx)`
61
+ * in an API.
62
+ *
63
+ * Manages the fact that we may use insensitive routing.
64
+ *
65
+ * @returns the last parameter with that key as a Number
66
+ * or `undefined` if not found.
67
+ * @throws An Error if the parameter is found but can't be parsed
68
+ * to a Number and no `errorHandler` is specified.
69
+ */
70
+ this.getQueryParamOneAsNumber = (req, key, errorHandler) => {
71
+ const numberStr = this.getQueryParamOne(req, key);
72
+ let val;
73
+ if (!general_utils_1.utils.isBlank(numberStr)) {
74
+ val = Number(numberStr);
75
+ if (isNaN(val)) {
76
+ const errorMsg = `Not a valid number: "${numberStr}"`;
77
+ if (errorHandler) {
78
+ return errorHandler(errorMsg, numberStr);
79
+ }
80
+ throw new Error(errorMsg);
81
+ }
82
+ }
83
+ return val;
84
+ };
85
+ /**
86
+ * Get the last value of a querystring parameter *as a boolean*.
87
+ * The value must be "true" or "false" (case insensitive) to
88
+ * be considered as a valid boolean. For example, the value '1'
89
+ * is invalid.
90
+ *
91
+ * @returns the last parameter with that key as a boolean
92
+ * or `undefined` if not found.
93
+ * @throws An Error if the parameter is found but can't be parsed
94
+ * to a valid boolean and no `errorHandler` is specified.
95
+ */
96
+ this.getQueryParamOneAsBoolean = (req, key, errorHandler) => {
97
+ const boolStr = this.getQueryParamOne(req, key);
98
+ if (general_utils_1.utils.isBlank(boolStr)) {
99
+ return undefined;
100
+ }
101
+ if (boolStr.toLowerCase() === 'true') {
102
+ return true;
103
+ }
104
+ if (boolStr.toLowerCase() === 'false') {
105
+ return false;
106
+ }
107
+ const errorMsg = `Not a valid boolean value: "${boolStr}"`;
108
+ if (errorHandler) {
109
+ return errorHandler(errorMsg, boolStr);
110
+ }
111
+ throw new Error(errorMsg);
112
+ };
113
+ /**
114
+ * Gets the "IOrderBy[]" from the querystring parameters
115
+ * of a search request.
116
+ *
117
+ * @see https://confluence.montreal.ca/pages/viewpage.action?spaceKey=AES&title=REST+API#RESTAPI-Tridelarequ%C3%AAte
118
+ */
119
+ this.getOrderBys = (req) => {
120
+ const orderBys = [];
121
+ const orderByStr = this.getQueryParamOne(req, 'orderBy');
122
+ if (general_utils_1.utils.isBlank(orderByStr)) {
123
+ return orderBys;
124
+ }
125
+ const tokens = orderByStr.split(',');
126
+ for (let token of tokens) {
127
+ token = token.trim();
128
+ let key = token;
129
+ let direction = general_utils_1.OrderByDirection.ASC;
130
+ if (token.startsWith('+')) {
131
+ key = token.substring(1);
132
+ }
133
+ else if (token.startsWith('-')) {
134
+ key = token.substring(1);
135
+ direction = general_utils_1.OrderByDirection.DESC;
136
+ }
137
+ const orderBy = {
138
+ key,
139
+ direction
140
+ };
141
+ orderBys.push(orderBy);
142
+ }
143
+ return orderBys;
144
+ };
145
+ }
146
+ /**
147
+ * Remove first and last slash of the string unless the string is the part after protocol (http://)
148
+ */
149
+ removeSlashes(text) {
150
+ if (text) {
151
+ let start;
152
+ let end;
153
+ start = 0;
154
+ while (start < text.length && text[start] === '/') {
155
+ start++;
156
+ }
157
+ end = text.length - 1;
158
+ while (end > start && text[end] === '/') {
159
+ end--;
160
+ }
161
+ let result = text.substring(start, end + 1);
162
+ // handle exception of the protocol that's followed with 2 slashes after the semi-colon.
163
+ if (result && result[result.length - 1] === ':') {
164
+ result += '/';
165
+ }
166
+ return result;
167
+ }
168
+ return text;
169
+ }
170
+ /**
171
+ * Join few parts of an url to a final string
172
+ */
173
+ urlJoin(...args) {
174
+ return _.map(args, this.removeSlashes)
175
+ .filter(x => !!x)
176
+ .join('/');
177
+ }
178
+ /**
179
+ * Sends a HTTP request built with Superagent.
180
+ *
181
+ * Will add the proper Correlation Id and will write
182
+ * useful logs.
183
+ *
184
+ * IMPORTANT : this method does NOT throw an Error on a
185
+ * 4XX-5XX status response! It will return it the same way
186
+ * it returns a 200 response and it is up to the calling code
187
+ * to validate the actual response's status. For example
188
+ * by using :
189
+ *
190
+ * if(response.ok) {...}
191
+ *
192
+ * and/or by checking the status :
193
+ *
194
+ * if(response.status === 404) {...}
195
+ *
196
+ * An error will be thrown only when a network problem occures or
197
+ * if the target server can't be reached.
198
+ *
199
+ * This is different from SuperAgent's default behavior that DOES
200
+ * throw an error on 4XX-5XX status responses.
201
+ *
202
+ */
203
+ async send(request) {
204
+ if (_.isNil(request)) {
205
+ throw new Error(`The request object can't be empty`);
206
+ }
207
+ if ('status' in request) {
208
+ throw new Error(`The request object must be of type SuperAgentRequest. Make sure this object has NOT already been awaited ` +
209
+ `prior to being passed here!`);
210
+ }
211
+ if (!request.url || request.url.indexOf('://') < 0) {
212
+ throw new Error(`The URL in your request MUST have a protocol and a hostname. Received: ${request.url}`);
213
+ }
214
+ if (general_utils_1.utils.isBlank(request.get(http_header_fields_typed_1.default.X_CORRELATION_ID))) {
215
+ const cid = configs_1.configs.correlationId;
216
+ if (!general_utils_1.utils.isBlank(cid)) {
217
+ request.set(http_header_fields_typed_1.default.X_CORRELATION_ID, cid);
218
+ }
219
+ }
220
+ // ==========================================
221
+ // Adds timeouts, if they are not already set.
222
+ // ==========================================
223
+ const responseTimeoutRequestVarName = '_responseTimeout';
224
+ const timeoutRequestVarName = '_timeout';
225
+ request.timeout({
226
+ response: request[responseTimeoutRequestVarName] !== undefined
227
+ ? request[responseTimeoutRequestVarName]
228
+ : constants_1.constants.request.timeoutsDefault.response,
229
+ deadline: request[timeoutRequestVarName] !== undefined
230
+ ? request[timeoutRequestVarName]
231
+ : constants_1.constants.request.timeoutsDefault.deadline
232
+ });
233
+ logger.debug({
234
+ sendingCorrelationIdHeader: request.get(http_header_fields_typed_1.default.X_CORRELATION_ID) || null,
235
+ url: request.url,
236
+ method: request.method,
237
+ msg: `Http Client - Start request to ${request.method} ${request.url}`
238
+ });
239
+ let result;
240
+ const timer = new general_utils_1.Timer();
241
+ try {
242
+ result = await request;
243
+ }
244
+ catch (err) {
245
+ // ==========================================
246
+ // SuperAgent throws a error on 4XX/5XX status responses...
247
+ // But we prefere to return those responses as regular
248
+ // ones and leave it to the caling code to validate
249
+ // the status! That way, we can differenciate between
250
+ // a 4XX/5XX result and a *real* error, for example if
251
+ // the request can't be sent because of a network
252
+ // error....
253
+ // ==========================================
254
+ if (err.status && err.response) {
255
+ result = err.response;
256
+ }
257
+ else {
258
+ // ==========================================
259
+ // Real error!
260
+ // ==========================================
261
+ logger.debug({
262
+ error: err,
263
+ url: request.url,
264
+ method: request.method,
265
+ timeTaken: timer.toString(),
266
+ msg: `Http Client - End request ERROR request to ${request.method} ${request.url}`
267
+ });
268
+ throw {
269
+ msg: `An error occured while making the HTTP request to ${request.method} ${request.url}`,
270
+ originalError: err
271
+ };
272
+ }
273
+ }
274
+ logger.debug({
275
+ url: request.url,
276
+ method: request.method,
277
+ statusCode: result.status,
278
+ timeTaken: timer.toString(),
279
+ msg: `Http Client - End request to ${request.method} ${request.url}`
280
+ });
281
+ return result;
282
+ }
283
+ /**
284
+ * Gets all the values of a querystring parameter.
285
+ * Manages the fact that we may use insensitive routing.
286
+ *
287
+ * A querystring parameter may indeed contains multiple values. For
288
+ * example : "path?name=aaa&name=bbb" will result in an
289
+ * *array* when getting the "name" parameter : ['aaa', 'bbb'].
290
+ *
291
+ * @returns all the values of the parameters as an array (even if
292
+ * only one value is found) or an empty array if none are found.
293
+ */
294
+ getQueryParamAll(req, key) {
295
+ if (!req || !req.query || !key) {
296
+ return [];
297
+ }
298
+ // ==========================================
299
+ // URL parsing is case sensitive. We can
300
+ // directly return the params as an array here.
301
+ // ==========================================
302
+ if (configs_1.configs.isUrlCaseSensitive) {
303
+ return this.getOriginalQueryParamAsArray(req, key);
304
+ }
305
+ // ==========================================
306
+ // The URL parsing is case *insensitive* here.
307
+ // We need more work to make sure we merge
308
+ // params in a case insensitive manner.
309
+ // ==========================================
310
+ if (!req[this.REQ_PARAMS_LOWERCASED]) {
311
+ req[this.REQ_PARAMS_LOWERCASED] = [];
312
+ Object.keys(req.query).forEach((keyExisting) => {
313
+ const keyLower = keyExisting.toLowerCase();
314
+ if (keyLower in req[this.REQ_PARAMS_LOWERCASED]) {
315
+ req[this.REQ_PARAMS_LOWERCASED][keyLower].push(req.query[keyExisting]);
316
+ }
317
+ else {
318
+ let val = req.query[keyExisting];
319
+ if (!_.isArray(val)) {
320
+ val = [val];
321
+ }
322
+ req[this.REQ_PARAMS_LOWERCASED][keyLower] = val;
323
+ }
324
+ });
325
+ }
326
+ const values = req[this.REQ_PARAMS_LOWERCASED][key.toLowerCase()];
327
+ return values || [];
328
+ }
329
+ /**
330
+ * Get the last value of a querystring parameter.
331
+ * Manages the fact that we may use insensitive routing.
332
+ *
333
+ * A querystring parameter may indeed contains multiple values. For
334
+ * example : "path?name=aaa&name=bbb" will result in an
335
+ * *array* when getting the "name" parameter : ['aaa', 'bbb'].
336
+ *
337
+ * In many situation, we only want to deal withy a single value.
338
+ * This function return the last value of a query param.
339
+ *
340
+ * @returns the last parameter with that key or `undefined` if
341
+ * not found.
342
+ */
343
+ getQueryParamOne(req, key) {
344
+ const values = this.getQueryParamAll(req, key);
345
+ if (!values || values.length === 0) {
346
+ return undefined;
347
+ }
348
+ return values[values.length - 1];
349
+ }
350
+ getOriginalQueryParamAsArray(req, key) {
351
+ let val = req.query[key];
352
+ if (_.isUndefined(val)) {
353
+ return [];
354
+ }
355
+ if (!_.isArray(val)) {
356
+ val = [val];
357
+ }
358
+ return val;
359
+ }
360
+ }
361
+ exports.HttpUtils = HttpUtils;
362
+ exports.httpUtils = new HttpUtils();
363
+ //# sourceMappingURL=httpUtils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"httpUtils.js","sourceRoot":"","sources":["../../src/httpUtils.ts"],"names":[],"mappings":";;;AAAA,kEAA0F;AAE1F,uEAA6D;AAC7D,4BAA4B;A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