Closed DmytryEmery closed 6 years ago
Currently the JSON serialization of the toxic object will add in fields like Toxicity, Direction or Name even if they are 'null' or default values.
Toxicity
Direction
Name
This means for example if you don't explicitly set Toxicity, you'll end up with 0.
However, there are defaults in the actual toxiproxy: https://github.com/Shopify/toxiproxy#toxic-fields
With this change the fields will not be included in the json created if they are null.
null
First test is a little fragile, since it depends on Toxiproxy's behavior e.g. Assert.Equal( "latency_downstream", toxic.Name );
Assert.Equal( "latency_downstream", toxic.Name );
Thanks for the contribution!
Currently the JSON serialization of the toxic object will add in fields like
Toxicity
,Direction
orName
even if they are 'null' or default values.This means for example if you don't explicitly set Toxicity, you'll end up with 0.
However, there are defaults in the actual toxiproxy: https://github.com/Shopify/toxiproxy#toxic-fields
With this change the fields will not be included in the json created if they are
null
.First test is a little fragile, since it depends on Toxiproxy's behavior e.g.
Assert.Equal( "latency_downstream", toxic.Name );