Closed RamiaSaidawi closed 2 years ago
This is happening because the server your target server is not returning a stable Content-Type
sometimes it is "application/json; charset=UTF-8"
and sometimes it is "application/json"
.
This means that some response bodies are serialised as if all the values are default and so the more compressed format is used and some response are serialised in the full format because the contentType field is not the default.
I'm not sure if this should be fixed or not. Ideally it would be fixed in this one case when returning recorded expectations but no in any other scenario when response bodies are being serialised otherwise the logs and UI and other elements would become more complex for scenarios when all default values are used. I'll think about if it is feasible / practical to do this or not without adding lots of complexity.
Thank you for your reply, hope you find a way to force the retrieveRecordedExpectations to be the same so i can build a robest mocking solution
Describe the issue When printing the recorded JSON, i get different schema
sometimes i get this:
and sometimes i get
What you are trying to do i want to use printed expectation json to create my mockserver expectations
MockServer version 5.11.1
To Reproduce
Load expectation with forwarding option
then do rest GET call for the mocked path
then log the
How you are running MockServer (i.e maven plugin, docker, etc) Mockserver as Junit Rule as well as on Docker
Code you used to create expectations see above
What error you saw no error, just not consistent json
Expected behaviour have the same fields returned always for recorded response
MockServer Log Log output, as INFO level (or lower)