class Namira::Middleware::Network
Performs the network request
Public Class Methods
new(app)
click to toggle source
# File lib/namira/middleware/network.rb, line 6 def initialize(app) @app = app end
Public Instance Methods
call(env)
click to toggle source
Called by the middleware runner.
@param env [Namira::Env] The request environment
# File lib/namira/middleware/network.rb, line 14 def call(env) timeout = env.config[:timeout] || 30.0 http = HTTP.timeout( write: timeout, connect: timeout, read: timeout ) http = http.headers(env.headers) env.response = http.send(env.method, env.uri, body: env.body) @app.call(env) end