Hello
I have a use case where I have to construct requests based on user input (OpenAPI documents), these contain arbitrary path params like /users/{user_id} and arbitrary query parameters. The query :paramscan be kept as a list of [{"key", value}] because they are passed directly to URI.encode_query/1. For :path_params they must be first converted to atom because the code assumes params to be a keyword list. I can do String.to_atom on the :path_params but that is susceptible to atom exhaustion attack.
Would it be possible to support also string keys for :path_params, the same as in query :params? In the apply_path_params function, instead of assuming a keyword list
params[String.to_existing_atom(key)]
we could do something like this?
def path_param(params, key) do
case List.keyfind(params, key, 0) do
{_key, value} -> value
nil -> params[String.to_exsting_atom(key)]
end
end
Hello
I have a use case where I have to construct requests based on user input (OpenAPI documents), these contain arbitrary path params like
/users/{user_id}and arbitrary query parameters. The query:paramscan be kept as a list of[{"key", value}]because they are passed directly toURI.encode_query/1. For:path_paramsthey must be first converted to atom because the code assumesparamsto be a keyword list. I can doString.to_atomon the:path_paramsbut that is susceptible to atom exhaustion attack.Would it be possible to support also string keys for
:path_params, the same as in query:params? In theapply_path_paramsfunction, instead of assuming a keyword listwe could do something like this?