Skip to content

Commit

Permalink
Merge pull request #2420 from san70sh/develop
Browse files Browse the repository at this point in the history
Fix 2419 - Multipart form fields ignoring numeric data
  • Loading branch information
ptrthomas authored Oct 21, 2023
2 parents 83392da + 8c673f2 commit 6f40066
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -491,6 +491,9 @@ private void multiPartInternal(String name, Object value) {
if (name != null) {
map.put("name", name);
}
if(value instanceof Number) {
value = value.toString();
}
if (value instanceof Map) {
map.putAll((Map) value);
String toRead = (String) map.get("read");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,36 @@ void testMultiPartField() {
matchVar("response", "{ foo: ['bar'] }");
}

@Test
void testMultiPartFieldWithInteger() {
background().scenario(
"pathMatches('/hello')",
"def response = requestParams");
run(
URL_STEP,
"def data = { foo: 'a', bar: 1}",
"multipart fields data",
"path 'hello'",
"method post"
);
matchVar("response", "{ foo: ['a'], bar: ['1'] } }");
}

@Test
void testMultiPartFieldWithFloat() {
background().scenario(
"pathMatches('/hello')",
"def response = requestParams");
run(
URL_STEP,
"def data = { foo: 1, bar: 2.0}",
"multipart fields data",
"path 'hello'",
"method post"
);
matchVar("response", "{ foo: ['1'], bar: ['2.0'] } }");
}

@Test
void testMultiPartFile() {
background().scenario(
Expand Down

0 comments on commit 6f40066

Please sign in to comment.