diff --git a/CHANGELOG.md b/CHANGELOG.md index e8e5c2f..5aceee4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +## [0.4.1] +* Add explict accept type for RestClient while requesting progile from FullContact + ## [0.4.0] * Add RestClient::Gone exception handling to return nil for HTTP 410 responses * Add test coverage for RestClient::Gone exception handling diff --git a/lib/fc_enrich/http_client.rb b/lib/fc_enrich/http_client.rb index 2975426..ccbc353 100644 --- a/lib/fc_enrich/http_client.rb +++ b/lib/fc_enrich/http_client.rb @@ -6,7 +6,9 @@ class HttpClient def post(path, payload_hash) response = RestClient.post("https://api.fullcontact.com#{path}", MultiJson.encode(payload_hash), - authorization: "Bearer #{FcEnrich.api_key}") + authorization: "Bearer #{FcEnrich.api_key}", + content_type: :json, + accept: :json) MultiJson.decode(response.body) rescue RestClient::NotFound, RestClient::UnprocessableEntity, RestClient::Gone nil diff --git a/lib/fc_enrich/version.rb b/lib/fc_enrich/version.rb index 0a1356b..4db6f74 100644 --- a/lib/fc_enrich/version.rb +++ b/lib/fc_enrich/version.rb @@ -1,3 +1,3 @@ module FcEnrich - VERSION = "0.4.0" + VERSION = "0.4.1" end diff --git a/spec/fc_enrich/http_client_spec.rb b/spec/fc_enrich/http_client_spec.rb index 49a8def..c3bd41a 100644 --- a/spec/fc_enrich/http_client_spec.rb +++ b/spec/fc_enrich/http_client_spec.rb @@ -8,7 +8,9 @@ module FcEnrich stub_request(:post, "https://api.fullcontact.com/v3/person.enrich") .with( body: "{\"my_data\":\"true\"}", - headers: { 'Authorization' => 'Bearer TEST!' } + headers: { 'Authorization' => 'Bearer TEST!', + 'Accept' => %r{\Aapplication/json\b}, + 'Content-Type' => %r{\Aapplication/json\b} } ) .to_return(status: 200, body: { "return" => "result" }.to_json)