From b33c165e1e6a24b3ee7d99dff7326c273d426ac4 Mon Sep 17 00:00:00 2001 From: kjgarza Date: Thu, 5 Mar 2020 12:25:15 +0100 Subject: [PATCH] get encoded response when calling works addresses https://github.com/datacite/lupo/issues/444 --- Gemfile.lock | 6 +++--- lib/api.rb | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index 58d76b2a..ea8eec4c 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -103,8 +103,8 @@ GEM loofah (2.4.0) crass (~> 1.0.2) nokogiri (>= 1.5.9) - maremma (4.5) - activesupport (>= 4.2.5, < 6) + maremma (4.6.1) + activesupport (>= 4.2.5) addressable (>= 2.3.6) builder (~> 3.2, >= 3.2.2) excon (~> 0.71.0) @@ -267,4 +267,4 @@ DEPENDENCIES will_paginate-bootstrap! BUNDLED WITH - 2.1.2 + 2.1.4 diff --git a/lib/api.rb b/lib/api.rb index 57dab366..4dc8d147 100644 --- a/lib/api.rb +++ b/lib/api.rb @@ -31,8 +31,8 @@ def get_works(params = {}) url = "#{ENV['API_URL']}/works?" + URI.encode_www_form(params) end - response = Maremma.get(url, timeout: TIMEOUT) - + response = Maremma.get(url, headers: { "Accept-Encoding"=> "gzip" }, timeout: TIMEOUT) + { data: response.body.fetch("data", []), included: response.body.fetch("included", []), errors: Array(response.body.fetch("errors", [])),