Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name = "ElasticsearchClient"
uuid = "e586a49d-aa29-4ce5-8f91-fa4f824367bd"
authors = ["Egor Shmorgun <egor.shmorgun@opensesame.com>"]
version = "0.2.7"
version = "0.2.8"

[deps]
CodecZlib = "944b1d66-785c-5afd-91f1-9de20f533193"
Expand Down
10 changes: 5 additions & 5 deletions src/elastic_transport/client.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,10 @@ function Client(;http_client::Module=HTTP, kwargs...)
)
end

function verify_elasticsearch(client::Client)
function verify_elasticsearch(client::Client; auth_params=nothing)
response = nothing
try
response = elastisearch_validation_request(client)
response = elastisearch_validation_request(client, auth_params=auth_params)
catch exc
if typeof(exc) in [Forbidden, Unauthorized, RequestEntityTooLarge]
client.verified = true
Expand All @@ -109,8 +109,8 @@ function verify_with_version_and_headers(client::Client, _headers, _version)
client.verified = true
end

function elastisearch_validation_request(client::Client)
@mock perform_request(client.transport, "GET", "/")
function elastisearch_validation_request(client::Client; auth_params=nothing)
@mock perform_request(client.transport, "GET", "/", auth_params=auth_params)
end

"""
Expand Down Expand Up @@ -141,7 +141,7 @@ function perform_request(
end

if !client.verified
verify_elasticsearch(client)
verify_elasticsearch(client, auth_params=auth_params)
end

@mock perform_request(
Expand Down