From 5380a94bc9e3b25071518db724fe85806036ac2f Mon Sep 17 00:00:00 2001 From: Wojtek Mach Date: Sat, 19 Aug 2023 00:29:00 +0200 Subject: [PATCH] opentelemetry_req: Don't assume `request.options` is a map (#192) --- .../opentelemetry_req/lib/opentelemetry_req.ex | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/instrumentation/opentelemetry_req/lib/opentelemetry_req.ex b/instrumentation/opentelemetry_req/lib/opentelemetry_req.ex index 6f3aeff..7e00a5a 100644 --- a/instrumentation/opentelemetry_req/lib/opentelemetry_req.ex +++ b/instrumentation/opentelemetry_req/lib/opentelemetry_req.ex @@ -209,12 +209,8 @@ 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 - {Req.Request.halt(request), __MODULE__.PathParamsOptionError.new()} - else - request - end + if !request.options[:no_path_params] and !request.options[:path_params] do + {Req.Request.halt(request), __MODULE__.PathParamsOptionError.new()} else request end @@ -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