Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
</elementProp>{{/queryParams}}{{#bodyParam}}
<elementProp name="{{paramName}}" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
{{=<% %>=}}<stringProp name="Argument.value">${<% paramName %>}</stringProp><%={{ }}=%>
{{=<% %>=}}<stringProp name="Argument.value">${__javaScript("${<% paramName %>}".replace(/'/g\, '"'),)}</stringProp><%={{ }}=%>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kannkyo thanks for the fix. I think one limitation with such approach is that if the json data contains ', e.g.

{
  "name": "John O'Shea"
}

the result will not work as it will become:

{
  "name": "John O"Shea"
}

I'm happy to merge this fix while looking for better approach to address cases like the above.

<stringProp name="Argument.metadata">=</stringProp>
</elementProp>{{/bodyParam}}
</collectionProp>
Expand Down
4 changes: 2 additions & 2 deletions samples/client/petstore/jmeter/PetApi.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down Expand Up @@ -504,7 +504,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/jmeter/StoreApi.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down
8 changes: 4 additions & 4 deletions samples/client/petstore/jmeter/UserApi.jmx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down Expand Up @@ -198,7 +198,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down Expand Up @@ -270,7 +270,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down Expand Up @@ -632,7 +632,7 @@
<collectionProp name="Arguments.arguments">
<elementProp name="body" elementType="HTTPArgument">
<boolProp name="HTTPArgument.always_encode">false</boolProp>
<stringProp name="Argument.value">${body}</stringProp>
<stringProp name="Argument.value">${__javaScript("${body}".replace(/'/g\, '"'),)}</stringProp>
<stringProp name="Argument.metadata">=</stringProp>
</elementProp>
</collectionProp>
Expand Down