Skip to content

Commit

Permalink
add ssl and authentication support based on the uri scheme (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfgil authored Jul 10, 2023
1 parent 446f53d commit 0aaa4b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/chroma/api_operations/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def execute_request(method, url, params = {}, options = {})

request = build_request(method, uri, params)

use_ssl = options.delete(:use_ssl) || false
use_ssl = uri.scheme == "https"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl:) do |http|
Chroma::Util.log_debug("Sending a request", {method:, uri:, params:})
http.request(request)
Expand Down Expand Up @@ -117,6 +117,7 @@ def execute_request(method, url, params = {}, options = {})

request.content_type = "application/json"
request.body = params.to_json if params.size > 0
request.basic_auth(uri.user, uri.password) if uri.user.present?

request
end
Expand Down

0 comments on commit 0aaa4b5

Please sign in to comment.