fix: Correctly render internal IDP errors

This commit is contained in:
Joachim Van Herwegen
2021-06-24 16:51:23 +02:00
parent 3a0cf60a55
commit c18b8526cc
2 changed files with 11 additions and 2 deletions

View File

@@ -84,6 +84,8 @@ export class IdentityProviderFactory {
},
renderError:
async(ctx: KoaContextWithOIDC, out: ErrorOut, error: Error): Promise<void> => {
// This allows us to stream directly to to the response object, see https://github.com/koajs/koa/issues/944
ctx.respond = false;
const preferences: RepresentationPreferences = { type: { 'text/plain': 1 }};
const result = await this.errorHandler.handleSafe({ error, preferences });
await this.responseWriter.handleSafe({ response: ctx.res, result });