-
Notifications
You must be signed in to change notification settings - Fork 169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix scope breaking change of request/response interception. (#241) #242
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this change mean we can get rid of the extend rspec matcher logic that was originally added to the tests in the original PR? 🤔
Ah, you mean |
) Signed-off-by: Hermann Mayer <[email protected]>
79cd335
to
5c01177
Compare
Yes, this is fine without due to the calling scope. I removed these calls. Thanks. |
# method if you like to. This is just a shortcut. | ||
def self.pass_request(params, headers, body, url, method) | ||
handler = proxy.request_handler.handlers[:proxy] | ||
response = handler.handle_request(method, url, headers, body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nab: It's interesting to see the difference between internet/external APIs here.
i.e. the method args are: params, headers, body, url, method
- but we're calling internally with method, url, headers, body
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes because of:
proxy.stub('http://example.com/').and_return(Proc.new { |*args|
response = pass_request(*args)
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes it easier to use here without introduce a breaking change (on the order of and_return
arguments). Its more likely to intercept the response and modify it as to tweak the request. It was fine in first place, no need to debate on it in a fixup.
# the request beforehand and/or modify the actual response which is passed | ||
# back by this method. But you can also implement a custom proxy passing | ||
# method if you like to. This is just a shortcut. | ||
def self.pass_request(params, headers, body, url, method) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just to confirm, is params
a dead variable here?
Looks good to me, happy to ship this @ronwsmith? :) |
@ronwsmith Ping? |
See: #241 (comment)