Skip to content

Conversation

alejandroereyes
Copy link

@alejandroereyes alejandroereyes commented Sep 17, 2020

Issue

I'm having to debug & handle rejected emails from sparkpost. Currently the client throws an exception if the response is not successful. While I don't want to change the current behavior and break everyone's integration, I still need access to the response in such a case.

I propose storing each response on a per call basis. This preserves the current behavior and allows anyone to rescue the exception and parse the response as needed.

Changes

  • each call to client#call clears out any old stored response & stores the most current raw response in an ivar
  • raw response is accessible to user via raw_response getter
  • ensure a string is sent to the logger for debugging the raw response

- each call to .call clears out old value & stores the most current raw
  response in an ivar
- raw response is accessible to user via raw_response getter
- ensure a string to sent to the logger for debugging the raw_response
@alejandroereyes alejandroereyes changed the title store-raw-response-per-call Store Raw Response Per Call Sep 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant