-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Req.merge
: Deep merge options
#319
Comments
this choice would prevent us from validating nested option names like: Req.Request.register_options(req, aws_sigv4: [:access_key_id, :region, ...]) so need to carefully consider it, maybe we can have it both ways but maybe we don't. |
I found myself on this issue when looking into merging the Req.post(
req,
headers: %{"X-Amz-Target" => "DynamoDB_20120810.Query"},
json: %{
"TableName" => "tablename",
"IndexName" => "indexname",
"KeyConditionExpression" => "someVal = :someval",
"ExpressionAttributeValues" => %{
":someval" => %{
"S" => "the value you're querying"
}
}
}
) If the response includes a Req.post(
req,
headers: %{"X-Amz-Target" => "DynamoDB_20120810.Query"},
json: %{
"TableName" => "tablename",
"IndexName" => "indexname",
"KeyConditionExpression" => "someVal = :someval",
"ExpressionAttributeValues" => %{
":someval" => %{
"S" => "the value you're querying"
}
},
"ExclusiveStartKey" => key
}
) It would be nice to just set the base json in req = update_in(req.options.json, fn j -> Map.put(j, "ExclusiveStartKey", key) end) but I'm not sure if that's kosher. I'm wary of messing directly with structs beneath the exposed functional interface. |
Right now we special case
:headers
and:params
. For example:Another one when this might be useful is aws_sigv4:
We could special case that one too or have a more generic mechanism when registering the options, something like:
The text was updated successfully, but these errors were encountered: