opentelemetry_req: Don't assume `request.options` is a map (#192)

This commit is contained in:
Wojtek Mach 2023-08-19 00:29:00 +02:00 committed by GitHub
parent e2faad163c
commit 5380a94bc9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 7 deletions

View File

@ -209,15 +209,11 @@ defmodule OpentelemetryReq do
end
defp require_path_params_option(request) do
unless request.options[:no_path_params] do
unless Map.has_key?(request.options, :path_params) do
if !request.options[:no_path_params] and !request.options[:path_params] do
{Req.Request.halt(request), __MODULE__.PathParamsOptionError.new()}
else
request
end
else
request
end
end
defmodule PathParamsOptionError do
@ -229,7 +225,7 @@ defmodule OpentelemetryReq do
@impl true
def message(_) do
"req_path_params path parameter options must be provided"
":path_params option must be set"
end
end
end