mirror of
https://github.com/CommunitySolidServer/CommunitySolidServer.git
synced 2024-10-03 14:55:10 +00:00
change: Do not warn in canHandle.
This commit is contained in:
parent
10946ffdb1
commit
baf68889f9
@ -21,7 +21,6 @@ export class BasicResponseWriter extends ResponseWriter {
|
||||
|
||||
public async canHandle(input: { response: HttpResponse; result: ResponseDescription | Error }): Promise<void> {
|
||||
if (input.result instanceof Error || input.result.metadata?.contentType === INTERNAL_QUADS) {
|
||||
this.logger.warn('This writer only supports binary ResponseDescriptions');
|
||||
throw new NotImplementedHttpError('Only successful binary responses are supported');
|
||||
}
|
||||
}
|
||||
|
@ -13,7 +13,6 @@ export class ErrorResponseWriter extends ResponseWriter {
|
||||
|
||||
public async canHandle(input: { response: HttpResponse; result: ResponseDescription | Error }): Promise<void> {
|
||||
if (!(input.result instanceof Error)) {
|
||||
this.logger.warn('This writer can only write errors');
|
||||
throw new NotImplementedHttpError('Only errors are supported');
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,6 @@ export class SparqlUpdateBodyParser extends BodyParser {
|
||||
public async canHandle({ request }: BodyParserArgs): Promise<void> {
|
||||
const contentType = request.headers['content-type'];
|
||||
if (contentType !== APPLICATION_SPARQL_UPDATE) {
|
||||
this.logger.debug(`Unsupported content type: ${contentType}`);
|
||||
throw new UnsupportedMediaTypeHttpError('This parser only supports SPARQL UPDATE data.');
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,3 @@
|
||||
import { getLoggerFor } from '../../logging/LogUtil';
|
||||
import { NotImplementedHttpError } from '../../util/errors/NotImplementedHttpError';
|
||||
import type { Operation } from '../operations/Operation';
|
||||
import type { PermissionSet } from './PermissionSet';
|
||||
@ -13,11 +12,8 @@ const SUPPORTED_METHODS = new Set([ ...READ_METHODS, ...WRITE_METHODS ]);
|
||||
* Specifically: GET, HEAD, POST, PUT and DELETE.
|
||||
*/
|
||||
export class MethodPermissionsExtractor extends PermissionsExtractor {
|
||||
protected readonly logger = getLoggerFor(this);
|
||||
|
||||
public async canHandle({ method }: Operation): Promise<void> {
|
||||
if (!SUPPORTED_METHODS.has(method)) {
|
||||
this.logger.warn(`Unrecognized method ${method}`);
|
||||
throw new NotImplementedHttpError(`Cannot determine permissions of ${method}`);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user