@server/next 0.17.1 → 0.17.2
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/package.json +1 -1
- package/src/index.js +4 -3
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -146,8 +146,8 @@ const parseOutput = async (res, data) => {
|
|
|
146
146
|
|
|
147
147
|
// When piping the output
|
|
148
148
|
if (data.pipe) {
|
|
149
|
-
res.body = data;
|
|
150
149
|
res.status = 200;
|
|
150
|
+
res.body = data;
|
|
151
151
|
// It's a file; find its mimetype
|
|
152
152
|
if (res.body.path) {
|
|
153
153
|
res.type = await getMime(res.body.path);
|
|
@@ -159,7 +159,7 @@ const parseOutput = async (res, data) => {
|
|
|
159
159
|
if (data.type) res.type = data.type;
|
|
160
160
|
res.headers = { ...res.headers, ...(data.headers || {}) };
|
|
161
161
|
res.body = data.body || ""; // This could also be a pipe and that's okay
|
|
162
|
-
res.status = data.status || 200;
|
|
162
|
+
res.status = data.status || 200; // user set > default
|
|
163
163
|
return res;
|
|
164
164
|
};
|
|
165
165
|
|
|
@@ -184,7 +184,8 @@ export default function (options = {}, plugins) {
|
|
|
184
184
|
|
|
185
185
|
let out;
|
|
186
186
|
let err;
|
|
187
|
-
|
|
187
|
+
// Will (hopefully) be overwritten later on!
|
|
188
|
+
ctx.res = { status: 500, headers: {} };
|
|
188
189
|
for (let cb of app.middleware) {
|
|
189
190
|
try {
|
|
190
191
|
if (err) {
|