spec/holodeck/holodeck.rb in twilio-ruby-5.38.0 vs spec/holodeck/holodeck.rb in twilio-ruby-5.39.0
- old
+ new
@@ -4,11 +4,11 @@
attr_accessor :host, :port
class Request
attr_reader :method, :url, :auth, :params, :data, :headers, :any
- def initialize(method: nil, url: nil, auth: nil, params: {}, data: {}, headers: nil, any: false)
+ def initialize(method: nil, url: nil, auth: nil, params: {}, data: {}, headers: {}, any: false)
@method = method
@url = url
@auth = auth
@params = params
@data = data
@@ -19,17 +19,22 @@
def any?
@any
end
def ==(other)
- method.casecmp(other.method.upcase).zero? &&
- url == other.url &&
- params == other.params &&
- data == other.data
+ if method.casecmp(other.method.upcase).zero? &&
+ url == other.url &&
+ params == other.params &&
+ data == other.data
+ other.headers.each do |h, value|
+ return false unless headers[h] == value
+ end
+ true
+ end
end
def to_s
- "#<Holodeck::Request method:#{method} url:#{url} params:#{params} data:#{data}>"
+ "#<Holodeck::Request method:#{method} url:#{url} params:#{params} data:#{data} headers:#{headers}>"
end
end
ANY = Request.new(any: true)