chore: coding style and comments (#1361)
* chore: coding style and comments * chore: optimize `ParseJsonBody` (#1353) * chore: optimize `ParseJsonBody` * chore: optimize `ParseJsonBody` * fix: fix a test * chore: optimize `ParseJsonBody` * fix a test * chore: add comment * chore: refactor Co-authored-by: chenquan <chenquan.dev@foxmail.com>
This commit is contained in:
@@ -89,6 +89,8 @@ func (h *timeoutHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
case <-ctx.Done():
|
||||
tw.mu.Lock()
|
||||
defer tw.mu.Unlock()
|
||||
// there isn't any user-defined middleware before TimoutHandler,
|
||||
// so we can guarantee that cancelation in biz related code won't come here.
|
||||
if errors.Is(ctx.Err(), context.Canceled) {
|
||||
w.WriteHeader(statusClientClosedRequest)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user