Class: A2A::Server::Bindings::Grpc
- Inherits:
-
Object
- Object
- A2A::Server::Bindings::Grpc
- Defined in:
- lib/a2a/server/bindings/grpc.rb
Overview
Rack middleware reserving a path prefix (default "/grpc") for the A2A gRPC protocol binding. Requests under the prefix get 501 Not Implemented; all other requests pass through untouched.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, path_prefix: "/grpc") ⇒ Grpc
constructor
A new instance of Grpc.
Constructor Details
#initialize(app, path_prefix: "/grpc") ⇒ Grpc
Returns a new instance of Grpc.
14 15 16 17 |
# File 'lib/a2a/server/bindings/grpc.rb', line 14 def initialize(app, path_prefix: "/grpc") @app = app @path_prefix = path_prefix end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 |
# File 'lib/a2a/server/bindings/grpc.rb', line 19 def call(env) return @app.call(env) unless claims?(env["PATH_INFO"]) body = { "type" => "error", "title" => "gRPC binding is not implemented", "status" => 501 } [501, { "content-type" => "application/problem+json" }, [JSON.generate(body)]] end |