Class: ClaudeAgentServer::Middleware::Cors
- Inherits:
-
Object
- Object
- ClaudeAgentServer::Middleware::Cors
- Defined in:
- lib/claude_agent_server/middleware/cors.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ Cors
constructor
A new instance of Cors.
Constructor Details
#initialize(app) ⇒ Cors
Returns a new instance of Cors.
6 7 8 |
# File 'lib/claude_agent_server/middleware/cors.rb', line 6 def initialize(app) @app = app end |
Instance Method Details
#call(env) ⇒ Object
10 11 12 13 14 15 16 17 18 |
# File 'lib/claude_agent_server/middleware/cors.rb', line 10 def call(env) origin = env['HTTP_ORIGIN'] return preflight_response(origin) if env['REQUEST_METHOD'] == 'OPTIONS' status, headers, body = @app.call(env) add_cors_headers(headers, origin) [status, headers, body] end |