Replies: 1 comment
-
@andradf thanks for your great suggestion. We had an internal discussion. The two major challenges are:
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
When I found the fix for the problem that was patched in PR #25113, I was surprised to find that the regression wasn't caught by any of the tests. Surely a breaking change to the HTTP request body of a request should be caught. Looking into how the project implements Http unit tests, it seems that HttpMockServer does not validate the request body. Only the url and method are matched against the definitions in the scenario file.
I have a couple of approaches in mind to fix this, but I would like some feedback before diving into making a change that would impact almost every test project.
We would compare the actual request body with the body defined in the scenario. Probably with some normalization for whitespace and element order. This should be able take care of deterministic cases, which should cover most cases.
If we need to support a non-deterministic request body then a simple solution could be to support defining a regex that a field must match. This complicates the whole object comparison vs option 1 since we can't just compare normalized strings.
This is probably the most elegant and maintainable solution, but the work required is also far greater than the others as we would have to define a schema for every request body.
Beta Was this translation helpful? Give feedback.
All reactions