Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

Remove unused after_request hooks from console API keys (#26896)

-LAN-e74097afdfa6
diff --git a/api/controllers/console/apikey.py b/api/controllers/console/apikey.py
index efab1bc03cd..7c39b044649 100644
--- a/api/controllers/console/apikey.py
+++ b/api/controllers/console/apikey.py
@@ -1,5 +1,4 @@
import flask_restx
-from flask import Response
from flask_restx import Resource, fields, marshal_with
from flask_restx._http import HTTPStatus
from sqlalchemy import select
@@ -156,11 +155,6 @@ class AppApiKeyListResource(BaseApiKeyListResource):
"""Create a new API key for an app"""
return super().post(resource_id)
- def after_request(self, resp: Response):
- resp.headers["Access-Control-Allow-Origin"] = "*"
- resp.headers["Access-Control-Allow-Credentials"] = "true"
- return resp
-
resource_type = "app"
resource_model = App
resource_id_field = "app_id"
@@ -177,11 +171,6 @@ class AppApiKeyResource(BaseApiKeyResource):
"""Delete an API key for an app"""
return super().delete(resource_id, api_key_id)
- def after_request(self, resp):
- resp.headers["Access-Control-Allow-Origin"] = "*"
- resp.headers["Access-Control-Allow-Credentials"] = "true"
- return resp
-
resource_type = "app"
resource_model = App
resource_id_field = "app_id"
@@ -206,11 +195,6 @@ class DatasetApiKeyListResource(BaseApiKeyListResource):
"""Create a new API key for a dataset"""
return super().post(resource_id)
- def after_request(self, resp: Response):
- resp.headers["Access-Control-Allow-Origin"] = "*"
- resp.headers["Access-Control-Allow-Credentials"] = "true"
- return resp
-
resource_type = "dataset"
resource_model = Dataset
resource_id_field = "dataset_id"
@@ -227,11 +211,6 @@ class DatasetApiKeyResource(BaseApiKeyResource):
"""Delete an API key for a dataset"""
return super().delete(resource_id, api_key_id)
- def after_request(self, resp: Response):
- resp.headers["Access-Control-Allow-Origin"] = "*"
- resp.headers["Access-Control-Allow-Credentials"] = "true"
- return resp
-
resource_type = "dataset"
resource_model = Dataset
resource_id_field = "dataset_id"