diff --git a/src/protocol/errors/internal-server-error.ts b/src/protocol/errors/internal-server-error.ts
index a7ae3a07..3bef060b 100644
--- a/src/protocol/errors/internal-server-error.ts
+++ b/src/protocol/errors/internal-server-error.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {BAD_GATEWAY} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -34,7 +34,7 @@ export class SCInternalServerErrorResponse extends SCError {
* and the internal server error should be displayed to the client
*/
constructor(err?: Error, stack = false) {
- super('InternalServerError', 'Internal server error', BAD_GATEWAY, stack);
+ super('InternalServerError', 'Internal server error', StatusCodes.BAD_GATEWAY, stack);
if (stack) {
this.additionalData = err;
diff --git a/src/protocol/errors/method-not-allowed.ts b/src/protocol/errors/method-not-allowed.ts
index 8830df32..7c5e90ce 100644
--- a/src/protocol/errors/method-not-allowed.ts
+++ b/src/protocol/errors/method-not-allowed.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {METHOD_NOT_ALLOWED} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -27,6 +27,6 @@ export class SCMethodNotAllowedErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
- super('MethodNotAllowedError', 'HTTP method is not allowed on this route', METHOD_NOT_ALLOWED, stack);
+ super('MethodNotAllowedError', 'HTTP method is not allowed on this route', StatusCodes.METHOD_NOT_ALLOWED, stack);
}
}
diff --git a/src/protocol/errors/not-found.ts b/src/protocol/errors/not-found.ts
index bc51dab6..1cf3f422 100644
--- a/src/protocol/errors/not-found.ts
+++ b/src/protocol/errors/not-found.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {NOT_FOUND} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -27,6 +27,6 @@ export class SCNotFoundErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
- super('NotFoundError', 'Resource not found', NOT_FOUND, stack);
+ super('NotFoundError', 'Resource not found', StatusCodes.NOT_FOUND, stack);
}
}
diff --git a/src/protocol/errors/parameters-not-acceptable.ts b/src/protocol/errors/parameters-not-acceptable.ts
index 00f4019a..cff4dfb2 100644
--- a/src/protocol/errors/parameters-not-acceptable.ts
+++ b/src/protocol/errors/parameters-not-acceptable.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {NOT_ACCEPTABLE} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -29,6 +29,6 @@ export class SCParametersNotAcceptable extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
- super('ParametersNotAcceptable', message, NOT_ACCEPTABLE, stack);
+ super('ParametersNotAcceptable', message, StatusCodes.NOT_ACCEPTABLE, stack);
}
}
diff --git a/src/protocol/errors/plugin-already-registered.ts b/src/protocol/errors/plugin-already-registered.ts
index 90122a40..c0397798 100644
--- a/src/protocol/errors/plugin-already-registered.ts
+++ b/src/protocol/errors/plugin-already-registered.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {CONFLICT} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
import {SCPluginMetaData} from '../routes/plugin-register';
@@ -38,7 +38,7 @@ export class SCPluginAlreadyRegisteredErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, plugin: SCPluginMetaData, stack = false) {
- super('SCPluginAlreadyRegisteredError', message, CONFLICT, stack);
+ super('SCPluginAlreadyRegisteredError', message, StatusCodes.CONFLICT, stack);
if (stack) {
this.additionalData = plugin;
}
diff --git a/src/protocol/errors/plugin-registering-failed.ts b/src/protocol/errors/plugin-registering-failed.ts
index 5b490e72..bd75201e 100644
--- a/src/protocol/errors/plugin-registering-failed.ts
+++ b/src/protocol/errors/plugin-registering-failed.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {INTERNAL_SERVER_ERROR} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -28,6 +28,6 @@ export class SCPluginRegisteringFailedErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
- super('PluginRegisteringFailedError', message, INTERNAL_SERVER_ERROR, stack);
+ super('PluginRegisteringFailedError', message, StatusCodes.INTERNAL_SERVER_ERROR, stack);
}
}
diff --git a/src/protocol/errors/request-body-too-large.ts b/src/protocol/errors/request-body-too-large.ts
index 003cc24a..ff572f80 100644
--- a/src/protocol/errors/request-body-too-large.ts
+++ b/src/protocol/errors/request-body-too-large.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {REQUEST_TOO_LONG} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -27,6 +27,6 @@ export class SCRequestBodyTooLargeErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
- super('RequestBodyTooLargeError', 'The request body is too large.', REQUEST_TOO_LONG, stack);
+ super('RequestBodyTooLargeError', 'The request body is too large.', StatusCodes.REQUEST_TOO_LONG, stack);
}
}
diff --git a/src/protocol/errors/syntax-error.ts b/src/protocol/errors/syntax-error.ts
index 41835cad..9bea0f17 100644
--- a/src/protocol/errors/syntax-error.ts
+++ b/src/protocol/errors/syntax-error.ts
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {BAD_REQUEST} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned whenever there is a syntax error
- *
+ *
* @validatable
*/
export class SCSyntaxErrorResponse extends SCError {
@@ -28,6 +28,6 @@ export class SCSyntaxErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(message: string, stack?: boolean) {
- super('SyntaxError', message, BAD_REQUEST, stack);
+ super('SyntaxError', message, StatusCodes.BAD_REQUEST, stack);
}
}
diff --git a/src/protocol/errors/too-many-requests.ts b/src/protocol/errors/too-many-requests.ts
index 823d7bc6..0865cd29 100644
--- a/src/protocol/errors/too-many-requests.ts
+++ b/src/protocol/errors/too-many-requests.ts
@@ -12,12 +12,12 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {TOO_MANY_REQUESTS} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
* An error that is returned, when to many request are submitted at once
- *
+ *
* @validatable
*/
export class SCTooManyRequestsErrorResponse extends SCError {
@@ -30,7 +30,7 @@ export class SCTooManyRequestsErrorResponse extends SCError {
super(
'TooManyRequestsError',
'Too many requests. You can not submit more than 5 queries an once',
- TOO_MANY_REQUESTS,
+ StatusCodes.TOO_MANY_REQUESTS,
stack,
);
}
diff --git a/src/protocol/errors/unsupported-media-type.ts b/src/protocol/errors/unsupported-media-type.ts
index 58023262..878f9708 100644
--- a/src/protocol/errors/unsupported-media-type.ts
+++ b/src/protocol/errors/unsupported-media-type.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {UNSUPPORTED_MEDIA_TYPE} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -27,6 +27,6 @@ export class SCUnsupportedMediaTypeErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(stack?: boolean) {
- super('UnsupportedMediaTypeError', 'Unsupported media type', UNSUPPORTED_MEDIA_TYPE, stack);
+ super('UnsupportedMediaTypeError', 'Unsupported media type', StatusCodes.UNSUPPORTED_MEDIA_TYPE, stack);
}
}
diff --git a/src/protocol/errors/validation.ts b/src/protocol/errors/validation.ts
index 7e3ecef2..f32e5bf3 100644
--- a/src/protocol/errors/validation.ts
+++ b/src/protocol/errors/validation.ts
@@ -13,7 +13,7 @@
* this program. If not, see .
*/
import {ValidationError} from '@openstapps/core-tools/lib/types/validator';
-import {BAD_REQUEST} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCError} from '../error';
/**
@@ -34,7 +34,7 @@ export class SCValidationErrorResponse extends SCError {
* @param stack Set to true if a stack trace should be created
*/
constructor(errors: ValidationError[], stack?: boolean) {
- super('ValidationError', 'Validation of request failed', BAD_REQUEST, stack);
+ super('ValidationError', 'Validation of request failed', StatusCodes.BAD_REQUEST, stack);
this.additionalData = errors;
}
}
diff --git a/src/protocol/routes/book-availability.ts b/src/protocol/routes/book-availability.ts
index 55f6c15a..15ff5949 100644
--- a/src/protocol/routes/book-availability.ts
+++ b/src/protocol/routes/book-availability.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCUuid} from '../../general/uuid';
import {SCAcademicPriceGroup, SCThingThatCanBeOfferedOffer} from '../../things/abstract/thing-that-can-be-offered';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
@@ -88,7 +88,7 @@ export class SCBookAvailabilityRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBookAvailabilityRequest';
this.responseBodyName = 'SCBookAvailabilityResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bookAvailability';
}
}
diff --git a/src/protocol/routes/bulk-add.ts b/src/protocol/routes/bulk-add.ts
index cbd80ca5..fec14320 100644
--- a/src/protocol/routes/bulk-add.ts
+++ b/src/protocol/routes/bulk-add.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {CREATED} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -59,7 +59,7 @@ export class SCBulkAddRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCBulkAddRequest';
this.responseBodyName = 'SCBulkAddResponse';
- this.statusCodeSuccess = CREATED;
+ this.statusCodeSuccess = StatusCodes.CREATED;
this.urlFragment = '/bulk/:UID';
}
}
diff --git a/src/protocol/routes/bulk-done.ts b/src/protocol/routes/bulk-done.ts
index 56239fe2..f1fc6011 100644
--- a/src/protocol/routes/bulk-done.ts
+++ b/src/protocol/routes/bulk-done.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {NO_CONTENT} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCNotFoundErrorResponse} from '../errors/not-found';
@@ -59,7 +59,7 @@ export class SCBulkDoneRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCBulkDoneRequest';
this.responseBodyName = 'SCBulkDoneResponse';
- this.statusCodeSuccess = NO_CONTENT;
+ this.statusCodeSuccess = StatusCodes.NO_CONTENT;
this.urlFragment = '/bulk/:UID/done';
}
}
diff --git a/src/protocol/routes/bulk-request.ts b/src/protocol/routes/bulk-request.ts
index 863a6b84..1c1e127a 100644
--- a/src/protocol/routes/bulk-request.ts
+++ b/src/protocol/routes/bulk-request.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCISO8601Date} from '../../general/time';
import {SCUuid} from '../../general/uuid';
import {SCThingType} from '../../things/abstract/thing';
@@ -98,7 +98,7 @@ export class SCBulkRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCBulkRequest';
this.responseBodyName = 'SCBulkResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/bulk';
}
}
diff --git a/src/protocol/routes/feedback.ts b/src/protocol/routes/feedback.ts
index 5c54a63e..b4dcdbc8 100644
--- a/src/protocol/routes/feedback.ts
+++ b/src/protocol/routes/feedback.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {NO_CONTENT} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCMessage} from '../../things/message';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -59,7 +59,7 @@ export class SCFeedbackRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCFeedbackRequest';
this.responseBodyName = 'SCFeedbackResponse';
- this.statusCodeSuccess = NO_CONTENT;
+ this.statusCodeSuccess = StatusCodes.NO_CONTENT;
this.urlFragment = '/feedback';
}
}
diff --git a/src/protocol/routes/index.ts b/src/protocol/routes/index.ts
index 42f89e10..e25aa0cf 100644
--- a/src/protocol/routes/index.ts
+++ b/src/protocol/routes/index.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCAppConfiguration} from '../../config/app';
import {SCBackendConfiguration} from '../../config/backend';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
@@ -65,7 +65,7 @@ export class SCIndexRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCIndexRequest';
this.responseBodyName = 'SCIndexResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/';
}
}
diff --git a/src/protocol/routes/plugin-register.ts b/src/protocol/routes/plugin-register.ts
index bdc53287..dd8d1cb6 100644
--- a/src/protocol/routes/plugin-register.ts
+++ b/src/protocol/routes/plugin-register.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {JSONSchema7} from 'json-schema';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -122,7 +122,7 @@ export class SCPluginRegisterRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCPluginRegisterRequest';
this.responseBodyName = 'SCPluginRegisterResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/plugin/register';
}
}
diff --git a/src/protocol/routes/search-multi.ts b/src/protocol/routes/search-multi.ts
index 71880292..4eab1e1c 100644
--- a/src/protocol/routes/search-multi.ts
+++ b/src/protocol/routes/search-multi.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCMap} from '../../general/map';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -63,7 +63,7 @@ export class SCMultiSearchRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCMultiSearchRequest';
this.responseBodyName = 'SCMultiSearchResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search/multi';
}
}
diff --git a/src/protocol/routes/search.ts b/src/protocol/routes/search.ts
index df2ec74b..d4e7bd2e 100644
--- a/src/protocol/routes/search.ts
+++ b/src/protocol/routes/search.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
import {SCRequestBodyTooLargeErrorResponse} from '../errors/request-body-too-large';
@@ -56,7 +56,7 @@ export class SCSearchRoute extends SCAbstractRoute {
this.method = SCRouteHttpVerbs.POST;
this.requestBodyName = 'SCSearchRequest';
this.responseBodyName = 'SCSearchResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/search';
}
}
diff --git a/src/protocol/routes/thing-update.ts b/src/protocol/routes/thing-update.ts
index 9ef23322..1980d736 100644
--- a/src/protocol/routes/thing-update.ts
+++ b/src/protocol/routes/thing-update.ts
@@ -12,7 +12,7 @@
* You should have received a copy of the GNU General Public License along with
* this program. If not, see .
*/
-import {OK} from 'http-status-codes';
+import {StatusCodes} from 'http-status-codes';
import {SCThings} from '../../meta';
import {SCInternalServerErrorResponse} from '../errors/internal-server-error';
import {SCMethodNotAllowedErrorResponse} from '../errors/method-not-allowed';
@@ -60,7 +60,7 @@ export class SCThingUpdateRoute extends SCAbstractRoute {
};
this.requestBodyName = 'SCThingUpdateRequest';
this.responseBodyName = 'SCThingUpdateResponse';
- this.statusCodeSuccess = OK;
+ this.statusCodeSuccess = StatusCodes.OK;
this.urlFragment = '/:TYPE/:UID';
}
}