mockserver: Error in deserialization of JSON
i’m trying to send application/x-www-form-urlencoded
request with body
to:email@email.com
this is the test code:
new MockServerClient("localhost", 1080) .when(request("/messages") .withMethod("POST") .withQueryStringParameter(Parameter.param("to","email@email.com")) ) .respond(response().withStatusCode(200));
And when this code is executed, i have this exception:
IllegalArgumentException: Exception while parsing [{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "email@email.com" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }] for Expectation
com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize instance of
java.lang.String out of FIELD_NAME token at [Source: (String)"{ "httpRequest" : { "method" : "POST", "path" : "/messages", "queryStringParameters" : { "to" : [ "email@email.com" ] } }, "httpResponse" : { "statusCode" : 200 }, "times" : { "remainingTimes" : 0, "unlimited" : true }, "timeToLive" : { "unlimited" : true } }"
How can i bypass or fix this?
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 3
- Comments: 17
Commits related to this issue
- update mockserver to 5.4.1 related https://github.com/jamesdbloom/mockserver/issues/451 — committed to lanwen/testcontainers-java by lanwen 6 years ago
- update mockserver to 5.4.1 (#832) related https://github.com/jamesdbloom/mockserver/issues/451 — committed to testcontainers/testcontainers-java by lanwen 6 years ago
I used version 5.1.1 and it worked.
Hi @IgorMaksymov ,
To what I have seen at the moment, it seems that the problem is for the com.fasterxml.jackson.core:jackson-databind:2.9.4 library.
For the moment to bypass the error I have forced the use of the com.fasterxml.jackson.core:jackson-databind:2.9.3 library.
@CarlosLoboZamarro thanks! In your explanation conflict and fix versions are the same. @jamesdbloom could you fix this issue? Because spring boot 2 provides this jackson dependency and its not good to exclude it from parent