Raw
 1package http
 2
 3import (
 4	"context"
 5	"net/http"
 6)
 7
 8type busyKey struct{}
 9
10func Busy(r *http.Request) bool {
11	b, _ := r.Context().Value(busyKey{}).(bool)
12	return b
13}
14
15func busyRequest(r *http.Request) *http.Request {
16	return r.WithContext(context.WithValue(r.Context(), busyKey{}, true))
17}
18
19func MarkBusy(r *http.Request) *http.Request {
20	return busyRequest(r)
21}