feat: add response description interface

This commit is contained in:
Joachim Van Herwegen
2020-06-23 10:04:51 +02:00
parent cf258d0317
commit e0343fca54
5 changed files with 21 additions and 11 deletions

View File

@@ -1,9 +1,9 @@
import { AsyncHandler } from '../../util/AsyncHandler';
import { HttpResponse } from '../../server/HttpResponse';
import { Operation } from '../operations/Operation';
import { ResponseDescription } from '../operations/ResponseDescription';
/**
* Writes to the HttpResponse.
* Response depends on the operation result and potentially which errors was thrown.
*/
export type ResponseWriter = AsyncHandler<{ response: HttpResponse; operation: Operation; error?: Error }>;
export abstract class ResponseWriter extends AsyncHandler<{ response: HttpResponse; description?: ResponseDescription; error?: Error }> {}