@tramvai/module-server 1.76.1 → 1.78.0
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/lib/server.es.js +15 -6
- package/lib/server.js +15 -6
- package/package.json +11 -11
package/lib/server.es.js
CHANGED
|
@@ -118,16 +118,25 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, a
|
|
|
118
118
|
},
|
|
119
119
|
]);
|
|
120
120
|
const responseManager = di.get(RESPONSE_MANAGER_TOKEN);
|
|
121
|
-
res
|
|
122
|
-
.
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
121
|
+
if (res.writableEnded) {
|
|
122
|
+
log.debug({
|
|
123
|
+
event: 'response-ended',
|
|
124
|
+
message: 'Response was already ended.',
|
|
125
|
+
url: req.url,
|
|
126
|
+
});
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
res
|
|
130
|
+
.set('content-type', 'text/html')
|
|
131
|
+
.set(responseManager.getHeaders())
|
|
132
|
+
.status(responseManager.getStatus())
|
|
133
|
+
.send(responseManager.getBody());
|
|
134
|
+
}
|
|
126
135
|
}
|
|
127
136
|
catch (err) {
|
|
128
137
|
if (err.di) {
|
|
129
138
|
const responseManager = err.di.get(RESPONSE_MANAGER_TOKEN);
|
|
130
|
-
if (responseManager) {
|
|
139
|
+
if (responseManager && !res.writableEnded) {
|
|
131
140
|
res.set(responseManager.getHeaders());
|
|
132
141
|
}
|
|
133
142
|
}
|
package/lib/server.js
CHANGED
|
@@ -140,16 +140,25 @@ const webAppInitCommand = ({ app, logger, commandLineRunner, beforeInit, init, a
|
|
|
140
140
|
},
|
|
141
141
|
]);
|
|
142
142
|
const responseManager = di.get(moduleCommon.RESPONSE_MANAGER_TOKEN);
|
|
143
|
-
res
|
|
144
|
-
.
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
143
|
+
if (res.writableEnded) {
|
|
144
|
+
log.debug({
|
|
145
|
+
event: 'response-ended',
|
|
146
|
+
message: 'Response was already ended.',
|
|
147
|
+
url: req.url,
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
res
|
|
152
|
+
.set('content-type', 'text/html')
|
|
153
|
+
.set(responseManager.getHeaders())
|
|
154
|
+
.status(responseManager.getStatus())
|
|
155
|
+
.send(responseManager.getBody());
|
|
156
|
+
}
|
|
148
157
|
}
|
|
149
158
|
catch (err) {
|
|
150
159
|
if (err.di) {
|
|
151
160
|
const responseManager = err.di.get(moduleCommon.RESPONSE_MANAGER_TOKEN);
|
|
152
|
-
if (responseManager) {
|
|
161
|
+
if (responseManager && !res.writableEnded) {
|
|
153
162
|
res.set(responseManager.getHeaders());
|
|
154
163
|
}
|
|
155
164
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tramvai/module-server",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.78.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"browser": "lib/browser.js",
|
|
6
6
|
"main": "lib/server.js",
|
|
@@ -19,14 +19,14 @@
|
|
|
19
19
|
"build-for-publish": "true"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@tinkoff/errors": "0.2.
|
|
22
|
+
"@tinkoff/errors": "0.2.19",
|
|
23
23
|
"@tinkoff/express-terminus": "0.1.13",
|
|
24
24
|
"@tinkoff/monkeypatch": "1.3.3",
|
|
25
25
|
"@tinkoff/url": "0.7.37",
|
|
26
|
-
"@tramvai/module-cache-warmup": "1.
|
|
27
|
-
"@tramvai/module-metrics": "1.
|
|
28
|
-
"@tramvai/papi": "1.
|
|
29
|
-
"@tramvai/tokens-server": "1.
|
|
26
|
+
"@tramvai/module-cache-warmup": "1.78.0",
|
|
27
|
+
"@tramvai/module-metrics": "1.78.0",
|
|
28
|
+
"@tramvai/papi": "1.78.0",
|
|
29
|
+
"@tramvai/tokens-server": "1.78.0",
|
|
30
30
|
"body-parser": "^1.19.0",
|
|
31
31
|
"compression": "^1.7.4",
|
|
32
32
|
"cookie-parser": "^1.4.3",
|
|
@@ -36,11 +36,11 @@
|
|
|
36
36
|
},
|
|
37
37
|
"peerDependencies": {
|
|
38
38
|
"@tinkoff/utils": "^2.1.2",
|
|
39
|
-
"@tramvai/cli": "1.
|
|
40
|
-
"@tramvai/core": "1.
|
|
41
|
-
"@tramvai/module-common": "1.
|
|
42
|
-
"@tramvai/module-environment": "1.
|
|
43
|
-
"@tramvai/tokens-common": "1.
|
|
39
|
+
"@tramvai/cli": "1.78.0",
|
|
40
|
+
"@tramvai/core": "1.78.0",
|
|
41
|
+
"@tramvai/module-common": "1.78.0",
|
|
42
|
+
"@tramvai/module-environment": "1.78.0",
|
|
43
|
+
"@tramvai/tokens-common": "1.78.0",
|
|
44
44
|
"@tinkoff/dippy": "0.7.38",
|
|
45
45
|
"tslib": "^2.0.3"
|
|
46
46
|
},
|