Class: Rack::PactBroker::InvalidUriProtection
- Inherits:
-
Object
- Object
- Rack::PactBroker::InvalidUriProtection
- Includes:
- PactBroker::Messages
- Defined in:
- lib/rack/pact_broker/invalid_uri_protection.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app) ⇒ InvalidUriProtection
constructor
A new instance of InvalidUriProtection.
Methods included from PactBroker::Messages
#message, #potential_duplicate_pacticipant_message, #validation_message
Constructor Details
#initialize(app) ⇒ InvalidUriProtection
Returns a new instance of InvalidUriProtection.
15 16 17 |
# File 'lib/rack/pact_broker/invalid_uri_protection.rb', line 15 def initialize app @app = app end |
Instance Method Details
#call(env) ⇒ Object
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/rack/pact_broker/invalid_uri_protection.rb', line 19 def call env if (uri = valid_uri?(env)) if ( = validate(uri)) [422, {'Content-Type' => 'text/plain'}, []] else app.call(env) end else [404, {}, []] end end |