Skip to content

Commit

Permalink
fix: 304 response error
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Jul 14, 2024
1 parent fc32036 commit 55c6f85
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions lib/middleware/template.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,22 @@ const middleware: MiddlewareHandler = async (ctx, next) => {
return ctx.json(result);
}

// retain .ums for backward compatibility
if (outputType === 'ums' || outputType === 'rss3') {
return ctx.json(rss3(result));
} else if (outputType === 'json') {
ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
return ctx.body(json(result));
} else if (ctx.get('no-content')) {
if (ctx.get('no-content')) {
return ctx.body(null);
} else if (outputType === 'atom') {
return ctx.render(<Atom data={result} />);
} else {
return ctx.render(<RSS data={result} />);
// retain .ums for backward compatibility
switch (outputType) {
case 'ums':
case 'rss3':
return ctx.json(rss3(result));
case 'json':
ctx.header('Content-Type', 'application/feed+json; charset=UTF-8');
return ctx.body(json(result));
case 'atom':
return ctx.render(<Atom data={result} />);
default:
return ctx.render(<RSS data={result} />);
}
}
};

Expand Down

0 comments on commit 55c6f85

Please sign in to comment.