diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bbad76f..464a33f2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +### Unreleased +* Added support for `Accept-Encoding: gzip` in HTTP headers + ### 6.2.0 / 2024-09-24 * Added query support for folders * Added dependency on `ostruct` gem diff --git a/lib/nylas/handler/http_client.rb b/lib/nylas/handler/http_client.rb index 1ba3d8b7..dea66044 100644 --- a/lib/nylas/handler/http_client.rb +++ b/lib/nylas/handler/http_client.rb @@ -108,7 +108,8 @@ def build_request( def default_headers @default_headers ||= { "X-Nylas-API-Wrapper" => "ruby", - "User-Agent" => "Nylas Ruby SDK #{Nylas::VERSION} - #{RUBY_VERSION}" + "User-Agent" => "Nylas Ruby SDK #{Nylas::VERSION} - #{RUBY_VERSION}", + "Accept-Encoding" => "gzip" } end diff --git a/spec/nylas/handler/http_client_spec.rb b/spec/nylas/handler/http_client_spec.rb index d5cef1e1..beee6d09 100644 --- a/spec/nylas/handler/http_client_spec.rb +++ b/spec/nylas/handler/http_client_spec.rb @@ -23,7 +23,8 @@ class TestHttpClient it "returns the default headers" do expect(http_client.send(:default_headers)).to eq( "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", - "X-Nylas-API-Wrapper" => "ruby" + "X-Nylas-API-Wrapper" => "ruby", + "Accept-Encoding" => "gzip" ) end end @@ -64,7 +65,8 @@ class TestHttpClient expect(request[:headers]).to eq( "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", "X-Nylas-API-Wrapper" => "ruby", - "Authorization" => "Bearer fake-key" + "Authorization" => "Bearer fake-key", + "Accept-Encoding" => "gzip" ) end @@ -84,7 +86,8 @@ class TestHttpClient "X-Nylas-API-Wrapper" => "ruby", "Authorization" => "Bearer fake-key", "X-Custom-Header" => "custom-value", - "X-Custom-Header-2" => "custom-value-2" + "X-Custom-Header-2" => "custom-value-2", + "Accept-Encoding" => "gzip" ) end @@ -98,7 +101,8 @@ class TestHttpClient expect(request[:headers]).to eq( "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", "X-Nylas-API-Wrapper" => "ruby", - "Authorization" => "Bearer fake-key" + "Authorization" => "Bearer fake-key", + "Accept-Encoding" => "gzip" ) expect(request[:timeout]).to eq(30) end @@ -114,7 +118,8 @@ class TestHttpClient expect(request[:headers]).to eq( "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", "X-Nylas-API-Wrapper" => "ruby", - "Authorization" => "Bearer fake-key" + "Authorization" => "Bearer fake-key", + "Accept-Encoding" => "gzip" ) end @@ -131,7 +136,8 @@ class TestHttpClient "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", "X-Nylas-API-Wrapper" => "ruby", "Authorization" => "Bearer fake-key", - "Content-type" => "application/json" + "Content-type" => "application/json", + "Accept-Encoding" => "gzip" ) end @@ -146,7 +152,8 @@ class TestHttpClient expect(request[:headers]).to eq( "User-Agent" => "Nylas Ruby SDK 1.0.0 - 5.0.0", "X-Nylas-API-Wrapper" => "ruby", - "Authorization" => "Bearer fake-key" + "Authorization" => "Bearer fake-key", + "Accept-Encoding" => "gzip" ) end end