TestServer inconsistency on "null" test
See original GitHub issueLet’s take this file: https://github.com/Azure/autorest.testserver/blob/master/swagger/body-integer.json
And the int_getNull
operation. Doing a call actually return no body with a 200:
The Swagger explains that it produces “application/json”, but an empty content is not a valid JSON, meaning the Swagger does not reflect the RestAPI…
Solution is to either change the testserver to put content-type “text/plain”, or to put the four characters null
(valid JSON).
I try to tighten a little my deserialisation, just to start thinking about future XML parsing in Python, and this kind of details blocks me 😦
Not urgent, but should be addressed.
FYI @amarzavery
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:7 (7 by maintainers)
Top Results From Across the Web
Integration test for ASP.NET Core 6 web API throws System ...
Solution: This was due to the Microsoft.AspNetCore.Mvc.Testing package for the test project using the wrong version (it was using version 5.
Read more >Route parameter with urlencoded slash. Inconsistency ...
Having a route parameter that includes a urlencoded / character produces inconsistent results between TestServer and Kestrel behavior.
Read more >Testing - Spring
This chapter covers Spring's support for integration testing and best practices for unit testing. The Spring team advocates test-driven ...
Read more >Testing an API In Memory in ASP.NET Core
This is long post that describes how to setup an in-memory test harness for testing an entire ASP.NET Core API with lots of...
Read more >Should you unit-test API/MVC controllers in ASP.NET Core?
You could have a method argument that's impossible to bind to a request, and unit tests won't identify that. Effectively, you may be...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@olydis Spec update https://tools.ietf.org/html/rfc7159
yep I wondered WTF that empty content instead of
null
is all about but the hard truth is that the C# generated code has encodednull
as empty string since I got here, I have no clue why this was done like that. At this point, it would be a slightly unpredicatable breaking change to change that behavior, so not sure what we can do… but I agree 100% that the testserver should test for the right thing, even if that means C# tests have to be skipped or changed