lib/medlink/client.rb in medlink-0.2.2 vs lib/medlink/client.rb in medlink-0.3.0
- old
+ new
@@ -5,10 +5,11 @@
response = faraday_client.post do |req|
req.url api_url(url)
req.headers['Authorization'] = "Token token=\"#{token}\""
req.headers['Content-Type'] = "application/json"
+ req.headers['Accept'] = "application/json"
req.body = JSON.generate(params)
end
raise UnauthorizedError, "Token '#{token}' is not valid" if response.status == 401
@@ -26,10 +27,9 @@
private
def faraday_client
@faraday_client ||= Faraday.new(url: site) do |faraday|
- faraday.request :url_encoded # form-encode POST params
faraday.adapter Faraday.default_adapter # make requests with Net::HTTP
end
end
def token
\ No newline at end of file