@riddl/core 0.2.2 → 0.2.3
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/dist/adapters.js +3 -6
- package/package.json +1 -1
package/dist/adapters.js
CHANGED
|
@@ -62,12 +62,9 @@ export const setResponse = async (res, response) => {
|
|
|
62
62
|
};
|
|
63
63
|
export const rawAdapter = (apiHandler) => (async (req, res) => {
|
|
64
64
|
const response = await apiHandler(toFetchRequest(req));
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
response.headers.forEach((value, key) => {
|
|
69
|
-
res.setHeader(key, value);
|
|
70
|
-
});
|
|
65
|
+
// Delegate entirely to setResponse. Do not preset Content-Length: 0 or
|
|
66
|
+
// Content-Type: application/json — that breaks SSE and other streaming
|
|
67
|
+
// bodies whose Response omits content-length (chunked transfer).
|
|
71
68
|
await setResponse(res, response);
|
|
72
69
|
});
|
|
73
70
|
export const expressAdapter = (apiHandler) => express.Router().use(rawAdapter(apiHandler));
|