@travetto/web-http 8.0.0-alpha.28 → 8.0.0-alpha.29

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/README.md CHANGED
@@ -341,7 +341,7 @@ static buildHandler(dispatcher: WebDispatcher): (request: HttpRequest, response:
341
341
  return async (request: HttpRequest, response: HttpResponse): Promise<void> => {
342
342
  const webRequest = this.toWebRequest(request);
343
343
  const webResponse = await dispatcher.dispatch({ request: webRequest });
344
- this.respondToServerResponse(webResponse, response);
344
+ await this.respondToServerResponse(webResponse, response);
345
345
  };
346
346
  }
347
347
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@travetto/web-http",
3
- "version": "8.0.0-alpha.28",
3
+ "version": "8.0.0-alpha.29",
4
4
  "type": "module",
5
5
  "description": "Web HTTP Server Support",
6
6
  "keywords": [
@@ -27,11 +27,11 @@
27
27
  "directory": "module/web-http"
28
28
  },
29
29
  "dependencies": {
30
- "@travetto/web": "^8.0.0-alpha.27"
30
+ "@travetto/web": "^8.0.0-alpha.28"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@travetto/cli": "^8.0.0-alpha.31",
34
- "@travetto/test": "^8.0.0-alpha.23"
34
+ "@travetto/test": "^8.0.0-alpha.24"
35
35
  },
36
36
  "peerDependenciesMeta": {
37
37
  "@travetto/test": {
package/src/http.ts CHANGED
@@ -32,7 +32,7 @@ export class WebHttpUtil {
32
32
  return async (request: HttpRequest, response: HttpResponse): Promise<void> => {
33
33
  const webRequest = this.toWebRequest(request);
34
34
  const webResponse = await dispatcher.dispatch({ request: webRequest });
35
- this.respondToServerResponse(webResponse, response);
35
+ await this.respondToServerResponse(webResponse, response);
36
36
  };
37
37
  }
38
38
 
@@ -130,9 +130,13 @@ export class WebHttpUtil {
130
130
  response.statusCode = WebCommonUtil.getStatusCode(binaryResponse);
131
131
 
132
132
  if (binaryResponse.body) {
133
- await BinaryUtil.pipeline(binaryResponse.body, response);
133
+ try {
134
+ await BinaryUtil.pipeline(binaryResponse.body, response);
135
+ } catch (error) {
136
+ console.error('Failed to send response', { error });
137
+ }
134
138
  }
135
- if (!response.closed) {
139
+ if (!response.closed && !response.destroyed) {
136
140
  response.end();
137
141
  }
138
142
  }