Skip to content

Commit

Permalink
Merge pull request #1 from karun-thatch/master
Browse files Browse the repository at this point in the history
enable Faraday raise_error middleware conditionally
  • Loading branch information
andreibondarev committed May 3, 2023
2 parents a3c31fe + cfb521e commit 9e2be22
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions lib/qdrant/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,20 @@ module Qdrant
class Client
extend Forwardable

attr_reader :url, :api_key, :adapter
attr_reader :url, :api_key, :adapter, :raise_error

def_delegators :service, :telemetry, :metrics, :locks, :set_lock

def initialize(
url:,
api_key: nil,
adapter: Faraday.default_adapter
adapter: Faraday.default_adapter,
raise_error: false
)
@url = url
@api_key = api_key
@adapter = adapter
@raise_error = raise_error
end

def connection
Expand All @@ -27,6 +29,7 @@ def connection
faraday.headers["api-key"] = api_key
end
faraday.request :json
faraday.response :raise_error if raise_error
faraday.response :json, content_type: /\bjson$/
faraday.adapter adapter
end
Expand Down

0 comments on commit 9e2be22

Please sign in to comment.