You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While using restit with one of my project, an uncanny bug comes out when the system gets a JSON response like this:
{"Status": "OK", "Results": null}
The Results field is supposed to be an array. The problem comes when I tried to decode the above respose to this structure:
type MyResponse struct {
Status string
Results []Item
}
Turns out that when encountering a null value in Results, json decoder wouldn't do anything to the existing field. So when I reuse a MyResponse variable over several tests, some test fails when the current JSON is null and there are previous value in MyResponse.Results field.
restit needs to reset the result at the beginning of the test (when Run or RunOrPanic).
The text was updated successfully, but these errors were encountered:
The `Response` interface now requires an additional `Reset` method.
`Run` and `RunOrPanic` will trigger this `Reset` method at the
beginning.
This will fix bug #2.
The `Response` interface now requires an additional `Reset` method.
`Run` and `RunOrPanic` will trigger this `Reset` method at the
beginning.
This will fix bug #2.
While using restit with one of my project, an uncanny bug comes out when the system gets a JSON response like this:
The
Results
field is supposed to be an array. The problem comes when I tried to decode the above respose to this structure:Turns out that when encountering a
null
value inResults
, json decoder wouldn't do anything to the existing field. So when I reuse aMyResponse
variable over several tests, some test fails when the current JSON isnull
and there are previous value inMyResponse.Results
field.restit
needs to reset the result at the beginning of the test (whenRun
orRunOrPanic
).The text was updated successfully, but these errors were encountered: