Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enable Faraday raise_error middleware conditionally #1

Merged
merged 1 commit into from
May 3, 2023
Merged
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
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