zendesk_api_client_rb
zendesk_api_client_rb copied to clipboard
[user error, but...] Possible bug? `Zlib::GzipFile::Error`
While trying to get idempotent requests working for ticketing, I tried some code below which gives us an error. That the API currently doesn't support idempotency via API requests (PLEASE ADD!) (https://github.com/zendesk/zendesk_api_client_rb/issues/510) wasn't known to me when I started trying to push a header into the request to mimic the behavior described in https://developer.zendesk.com/api-reference/ticketing/introduction/#idempotency, in the following way.
It doesn't work, and this is on me for trying to end-run the lack of functionality, but the RESULT is error: "Zlib::GzipFile::Error", which I just don't understand. This isn't anything Zendesk necessarily needs to address because I was not using the API in the right way, but wanted to report it IN CASE it's a symptom of something else.
Code to trigger the issue. I tried various other ways of merging this into existing :header hashes, which since there wasn't one is essentially the same thing as just overwriting it like below.
ZendeskAPI::Client.new do |config|
config.url = "#{url}/api/v2"
config.username = username
config.token = token
if idempotency_key
config.client_options = {
headers: {
'Idempotency-Key' => idempotency_key
}
}
config.allow_http = Rails.env.development?
end
end
FYI... (but again, please add idempotency to the API, pretty please.)
(edit:) This code I posted is several months old, and we think it USED TO WORK (at least didn't fail with this error) up to about a month ago. Not sure if something on our side change then or in the Zendesk's internals, but just a data point.)