Closed cgarciae closed 8 years ago
Looking at the code it seems that request.body
s values are always Strings.
How about this?
try {
return decode(data, paramType);
} catch (e) {
try {
return mirrors.reflectClass(paramType).newInstance(#fromStringMap, [data]).reflectee;
}
catch (e2) {
throw new ErrorResponse(
400, "$handlerName: Error parsing '$paramName' parameter: $e\n\nError using 'fromJson' constructor: $e2");
}
}
It might be nicer if the decoder tried to parse String to int before failing in general.
Is this still relevant? Also, shouldn't this issue be opened on the plugin's repo directly [or is it a bug with redstone specifically?]
I have this test class and route that tries to parse a form containing a integer value
But this error arises as a result
It look like its trying to decode a Map to a TestClass but fails because the maps "number" field is a String.