@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
|
-
|
94
|
-
|
95
|
-
|
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):
|
37
|
+
static checkContentType(contentType: MediaType): CheckerFunction;
|
38
38
|
}
|
39
39
|
export declare class GeoJsonChecker {
|
40
40
|
static validFeatureCollection(fn?: (json: FeatureCollection) => void): CheckerFunction;
|
package/package.json
CHANGED
@@ -119,9 +119,13 @@ export class DigitrafficMethodResponse {
|
|
119
119
|
[mediaType]: model,
|
120
120
|
},
|
121
121
|
responseParameters: {
|
122
|
-
|
123
|
-
|
124
|
-
|
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
|
}
|