Details
-
Improvement
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
Description
In the handler_test.go file we have an anti pattern showing a large number (40+) warnings in an IDE:
'req' might have 'nil' or other unexpected value as its corresponding error variable might be not 'nil'
The warning are due to the fact that we have the following pattern:
req, err = http.NewRequest("GET", "path", strings.NewReader("")) req = req.WithContext(context.WithValue(req.Context(), httprouter.ParamsKey, httprouter.Params{}))
There is no error assertion after the request creation. We should add a simple assert.NilError(t, err, "HTTP request create failed") inserted between creating and using the request.
Attachments
Issue Links
- links to