Sha256: 43a49aa5f8af0ffdee81c1f18146b2320d0eee454835b7706a5deb3af9006f08
Contents?: true
Size: 899 Bytes
Versions: 2
Compression:
Stored size: 899 Bytes
Contents
module Restspec module Endpoints module Network extend self def request(request_object) code, headers, body = network_adapter.request(request_object) Response.new(code, headers, body) end private def network_adapter network_adapter_lambda.try(:call) || default_network_adapter end def network_adapter_lambda Restspec.config.request.network_adapter end def default_network_adapter HTTPartyNetworkAdapter.new end class HTTPartyNetworkAdapter def request(request_object) response = HTTParty.send( request_object.method, request_object.url, headers: request_object.headers, body: request_object.raw_payload ) [response.code, response.headers, response.body] end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
restspec-0.0.2 | lib/restspec/endpoints/network.rb |
restspec-0.0.1 | lib/restspec/endpoints/network.rb |