-
Bug
-
Resolution: Fixed
-
Neutral
-
None
-
1.5.3
-
None
-
-
Yes
-
Empty show more show less
I've created a method which POST some data to the rest service. There's no any parameters there. It gets only JSON body.
@POST
@Path("/product")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
ResponseDto postMethod(SomeModel someModel);
When I try to execute it through Rest Client app. And because of no parameters I have to keep method parameters empty.
And there's a code in RestClientAppPresenter class which checks for empty parameters string and returns empty method parameters array and don't include body to it.
private Object[] parseParameters(Method method, String parametersAsString, String body) throws IOException { List<Object> parameters = new ArrayList<Object>(); if (StringUtils.isNotEmpty(parametersAsString)) { Map<String, String> parametersMap = Splitter.on("\n").withKeyValueSeparator("=").split(StringUtils.trimToEmpty(parametersAsString)); Class[] types = method.getParameterTypes(); Annotation[][] annotations = method.getParameterAnnotations(); if (types.length != parametersMap.size() + (this.getBodyClass(types, annotations) != null ? 1 : 0)) { throw new IllegalArgumentException("Wrong number of arguments"); } for (int i = 0; i < types.length; i++) { if (annotations[i].length == 0) { //body param parameters.add(corvertValue(body, types[i])); } else { parameters.add(corvertValue(parametersMap.get(this.getAnnotationValue(annotations[i])), types[i])); } } } return parameters.toArray(); }
The decision is to remove this check.
Acceptance criteria