Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 3 additions & 1 deletion lib/fc_enrich/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/fc_enrich/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module FcEnrich
VERSION = "0.4.0"
VERSION = "0.4.1"
end
Comment thread
bapu-nexl marked this conversation as resolved.
4 changes: 3 additions & 1 deletion spec/fc_enrich/http_client_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading