@atlantjs/backend 11.0.0 → 11.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -4,12 +4,21 @@ exports.Delete = exports.Patch = exports.Put = exports.Post = exports.Get = void
|
|
|
4
4
|
const http_content_type_point_1 = require("./http-content-type.point");
|
|
5
5
|
const http_method_point_1 = require("./http-method.point");
|
|
6
6
|
require("reflect-metadata");
|
|
7
|
+
const routing_controllers_1 = require("routing-controllers");
|
|
7
8
|
function HttpMethod(method) {
|
|
8
9
|
return (path, contentType = http_content_type_point_1.HttpContentTypePoint.JSON) => {
|
|
9
10
|
return (target) => {
|
|
10
11
|
Reflect.defineMetadata("http:method", method.toLowerCase(), target);
|
|
11
12
|
Reflect.defineMetadata("http:path", path, target);
|
|
12
13
|
Reflect.defineMetadata("http:content-type", contentType, target);
|
|
14
|
+
if (contentType === "application/json") {
|
|
15
|
+
(0, routing_controllers_1.getMetadataArgsStorage)().controllers.push({
|
|
16
|
+
type: "json",
|
|
17
|
+
target,
|
|
18
|
+
route: typeof path === "string" ? path : path.source,
|
|
19
|
+
options: {},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
13
22
|
};
|
|
14
23
|
};
|
|
15
24
|
}
|