All files / src/endpoint json.ts

100% Statements 5/5
100% Branches 0/0
100% Functions 2/2
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 199x     9x       3x           12x       9x  
import Endpoint from 'endpoint';
import HttpError from 'http/error';
import JsonObject from 'http/type/json-object';
import ContentType from 'http/enum/content-type';
 
abstract class JsonEndpoint<Input> extends Endpoint<Input, JsonObject> {
	protected serializeError(error: HttpError): JsonObject {
		return {
			message: error.message
		};
	}
 
	protected getResponseContentType(): ContentType {
		return ContentType.JSON;
	}
}
 
export default JsonEndpoint;