Skip to content

Commit

Permalink
enable Faraday raise_error middleware conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
karun-thatch committed May 3, 2023
1 parent a3c31fe commit cfb521e
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 cfb521e

Please sign in to comment.