Closed matadon closed 5 years ago
I'd love to have this get merged to lostisland:master. I was just about to write the exact same change for lazy decoding.
My use case is that I'm using Sawyer in an Octokit-based client to our web service that we build as an SDK that we provide to customers. Sometimes the SDK is used with stand-alone code where the Sawyer objects are perfect. But, sometimes, it is used by the server-side of a webapp where I really just want to return the exact same body received from the web service - w/o having to incur the cost of the decode and re-encode of the Sawyer objects.
Thanks!
5 Y E A R S L A T E R
Thanks for the patch. I'll try to get out another sawyer gem point release this week.
Sawyer::Response now exposes #env and #body for accessing raw request data. #data itself now memoizes when first called, rather than handling the response decoding in #initialize.
Sometimes, you just need access to the raw data. In my case, I've got some slightly oddball JSON processing to do, plus some Faraday middleware that stores resuls in
response.env
.