-
Notifications
You must be signed in to change notification settings - Fork 508
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
Key containing periods behave oddly #879
Comments
I'm using version ^2.0.12 and I'm facing the same issue. I have looked through the documentation but couldn't find anything that could help. |
Hi - we ran into this issue too and think we've found where it happens. I have a workaround but not a complete solution, so leaving findings here in case useful to any eventual fixer-upper: The issue stems from this line here (commons/engine_util.js, 289) where the code sets the parsed value at the matching path in the result object. The code calls lodash's
Hacky workaround we've taken is to patch the package to treat the prefix as a string key, rather than a parseable path, like so:
this works for our case (a prefix like |
We're also new to Artillery ( We're going to give the above patch a go this AM, but is there any prospect of a proper fix (be it the above patch or a more expansive case-covering alternative fix) being shipped as part of an official update? Thank you! |
The solution posted by @drew-vault sadly didn't work for us as we have to deal with arrays as well. However, I assume that the behavior observed is not intended and a side-effect of // Mutates the object in place
function templateObject(o, context) {
Object.entries(o).forEach(([key, value]) => {
if (value && value.constructor !== Object && value.constructor !== Array) {
o[key] = template(value, context, true);
} else {
templateObjectOrArray(value, context);
}
});
}
// Mutates the array in place
function templateArray(o, context) {
o.forEach((value, index) => {
if (value && value.constructor !== Object && value.constructor !== Array) {
o[index] = template(value, context, true);
} else {
templateObjectOrArray(value, context);
}
});
}
// Mutates the object or array in place
function templateObjectOrArray(o, context) {
if (o.constructor === Array) {
templateArray(o, context);
} else {
templateObject(o, context);
}
} Happy to open a PR for that if desired! |
I am reporting this because the behavior seems a bit strange.
When running artillery with json key that contains a dot the actually sent payload produces a duplicate.
This is the yaml file:
And this is the produced payload using DEBUG=http artillery run myscript.yaml
I was hoping to get the first entry.
"foo.bar": [
"M",
"L"
],
NOT:
"foo": {
"bar": [
"M",
"L"
]
}
Though, I can understand how that might be the expected behavior, but it seems really strange to have both?
Is there anyway to get this to be the only entry in the payload?
"foo.bar": [
"M",
"L"
],
Thanks for your time!
The text was updated successfully, but these errors were encountered: