-
Notifications
You must be signed in to change notification settings - Fork 12
Open
Description
A great looking gem. 👍
I was hoping to use wrap_and_check around some sendgrid-ruby requests, which return non-2XX response codes rather than raising exceptions. However the SendGrid::Response object exposes its status code through status_code() rather than code().
I can monkey-patch sendgrid-ruby to provide the code() method, but I wonder if this might be a nice configuration option for http-exceptions instead - maybe something like:
Http::Exceptions.configure do |config|
config.status_code_method = :status_code
endOr, perhaps an option to wrap_and_check would be even better?
response = Http::Exceptions.wrap_and_check(status_code_method: :status_code) do
client.mail._('send').post(request_body: message.to_json)
endIf you think this might be useful, I'd be happy to wrap up a PR for it.
Metadata
Metadata
Assignees
Labels
No labels