@digitraffic/common 2023.1.23-3 → 2023.1.26-1

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.
@@ -90,9 +90,13 @@ class DigitrafficMethodResponse {
90
90
  [mediaType]: model,
91
91
  },
92
92
  responseParameters: {
93
- "method.response.header.Access-Control-Allow-Origin": !disableCors,
94
- "method.response.header.Deprecation": deprecation,
95
- "method.response.header.Sunset": deprecation,
93
+ ...(!disableCors && {
94
+ "method.response.header.Access-Control-Allow-Origin": true,
95
+ }),
96
+ ...(deprecation && {
97
+ "method.response.header.Deprecation": true,
98
+ "method.response.header.Sunset": true,
99
+ }),
96
100
  },
97
101
  };
98
102
  }
@@ -34,7 +34,7 @@ export declare class ContentChecker {
34
34
  static checkResponse(fn: (body: string, res: IncomingMessage) => void): CheckerFunction;
35
35
  }
36
36
  export declare class ContentTypeChecker {
37
- static checkContentType(contentType: MediaType): (res: IncomingMessage) => void;
37
+ static checkContentType(contentType: MediaType): CheckerFunction;
38
38
  }
39
39
  export declare class GeoJsonChecker {
40
40
  static validFeatureCollection(fn?: (json: FeatureCollection) => void): CheckerFunction;
@@ -233,6 +233,7 @@ class ContentTypeChecker {
233
233
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
234
234
  `Wrong content-type ${res.headers["content-type"]}`);
235
235
  }
236
+ return Promise.resolve();
236
237
  };
237
238
  }
238
239
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@digitraffic/common",
3
- "version": "2023.01.23-3",
3
+ "version": "2023.01.26-1",
4
4
  "description": "",
5
5
  "repository": {
6
6
  "type": "git",
@@ -119,9 +119,13 @@ export class DigitrafficMethodResponse {
119
119
  [mediaType]: model,
120
120
  },
121
121
  responseParameters: {
122
- "method.response.header.Access-Control-Allow-Origin": !disableCors,
123
- "method.response.header.Deprecation": deprecation,
124
- "method.response.header.Sunset": deprecation,
122
+ ...(!disableCors && {
123
+ "method.response.header.Access-Control-Allow-Origin": true,
124
+ }),
125
+ ...(deprecation && {
126
+ "method.response.header.Deprecation": true,
127
+ "method.response.header.Sunset": true,
128
+ }),
125
129
  },
126
130
  };
127
131
  }
@@ -318,7 +318,7 @@ export class ContentChecker {
318
318
  }
319
319
 
320
320
  export class ContentTypeChecker {
321
- static checkContentType(contentType: MediaType) {
321
+ static checkContentType(contentType: MediaType): CheckerFunction {
322
322
  return (res: IncomingMessage) => {
323
323
  if (!res.statusCode) {
324
324
  throw new Error("statusCode missing");
@@ -339,6 +339,8 @@ export class ContentTypeChecker {
339
339
  `Wrong content-type ${res.headers["content-type"]!}`
340
340
  );
341
341
  }
342
+
343
+ return Promise.resolve();
342
344
  };
343
345
  }
344
346
  }