mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
fix: Prevent server from crashing if requested data can't be handled
This commit is contained in:
@@ -12,6 +12,11 @@ export class SimpleResponseWriter extends ResponseWriter {
|
||||
if (!input.description && !input.error) {
|
||||
throw new UnsupportedHttpError('Either a description or an error is required for output.');
|
||||
}
|
||||
if (input.description && input.description.body) {
|
||||
if (input.description.body.dataType !== 'binary' && input.description.body.dataType !== 'string') {
|
||||
throw new UnsupportedHttpError('Only string or binary results are supported.');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public async handle(input: { response: HttpResponse; description?: ResponseDescription; error?: Error }): Promise<void> {
|
||||
|
||||
Reference in New Issue
Block a user