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
end
Or, 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)
end
If you think this might be useful, I'd be happy to wrap up a PR for it.
A great looking gem. 👍
I was hoping to use
wrap_and_checkaround somesendgrid-rubyrequests, which return non-2XX response codes rather than raising exceptions. However theSendGrid::Responseobject exposes its status code throughstatus_code()rather thancode().I can monkey-patch
sendgrid-rubyto provide thecode()method, but I wonder if this might be a nice configuration option forhttp-exceptionsinstead - maybe something like:Or, perhaps an option to
wrap_and_checkwould be even better?If you think this might be useful, I'd be happy to wrap up a PR for it.