The reason is AbortWithStatus will firstly call WriteHeader and then call WriteHeaderNow for double check (confirm the header already be written and the http status code is not modified).
In the master branch, WriteHeader implemented by timeout repo, but WriteHeaderNow implemented by gin repo. And this cause the double write for http status code and the failure.
gin warning:
reproduced by following code:
The reason is
AbortWithStatus
will firstly callWriteHeader
and then callWriteHeaderNow
for double check (confirm the header already be written and the http status code is not modified).In the master branch,
WriteHeader
implemented bytimeout
repo, butWriteHeaderNow
implemented bygin
repo. And this cause the double write for http status code and the failure.