Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions endpoint/tests/test_endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def test_routing(self):
"methods": ["GET"],
"routes": ["/demo/one"],
"type": "http",
"cors": "*",
"csrf": False,
"readonly": False,
},
Expand All @@ -161,6 +162,7 @@ def test_routing(self):
"methods": ["POST"],
"routes": ["/new/one"],
"type": "http",
"cors": "*",
"csrf": False,
"readonly": False,
},
Expand All @@ -176,6 +178,7 @@ def test_routing(self):
"methods": ["POST"],
"routes": ["/foo/new/one"],
"type": "http",
"cors": "*",
"csrf": False,
"readonly": False,
},
Expand Down
1 change: 1 addition & 0 deletions endpoint/views/endpoint_view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
required="request_method in ('POST', 'PUT')"
invisible="request_method not in ('POST', 'PUT')"
/>
<field name="cors" />
</group>
</group>
</page>
Expand Down
2 changes: 2 additions & 0 deletions endpoint_route_handler/models/endpoint_route_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class EndpointRouteHandler(models.AbstractModel):
endpoint_hash = fields.Char(
compute="_compute_endpoint_hash", help="Identify the route with its main params"
)
cors = fields.Char(help="Comma-separated list of allowed origins", default="*")
csrf = fields.Boolean(default=False)
readonly = fields.Boolean(default=False)

Expand Down Expand Up @@ -248,6 +249,7 @@ def _get_routing_info(self):
auth=self.auth_type,
methods=[self.request_method],
routes=[route],
cors=self.cors,
csrf=self.csrf,
readonly=self.readonly,
)
Expand Down
Loading