mockserver
mockserver copied to clipboard
Getting a ParameterBody from a HttpRequest in a class that implements ExpectationResponseCallback
Hi,
I am using mockserver (5.14.0) to generate dynamic responses and trying to get form body parameters in a class that extends ExpectationResponseCallback
.
When mockserver receives a request with content type of
"Content-Type" : [ "application/x-www-form-urlencoded; charset=UTF-8" ]
and the body value of
entityId=8a8294175655aa1501566c8f57a2297b&amount=2.43¤cy=USD
the request body is recognized as StringBody
despite the content type.
@Override
public HttpResponse handle(HttpRequest httpRequest) {
Body<?> body = httpRequest.getBody(); <-- StringBody
...
}
even though it contains HTTP form data.
I was under the impression that I can get parsed form parameters in this case retuned in a ParameterBody instance. Or is ParameterBody only usable for creating responses? Thank you!