IsInternalRequest reports whether r was dispatched via InternalRequest rather than arriving over the network. Handlers can use this to skip audit logging, rate limiting, or other concerns that only apply to external callers.
(r *http.Request)
| 24 | // than arriving over the network. Handlers can use this to skip audit logging, |
| 25 | // rate limiting, or other concerns that only apply to external callers. |
| 26 | func IsInternalRequest(r *http.Request) bool { |
| 27 | v, _ := r.Context().Value(internalCallerKey).(bool) |
| 28 | return v |
| 29 | } |
| 30 | |
| 31 | // withTestModeContext returns a copy of ctx marked as a test-mode request. |
| 32 | func withTestModeContext(ctx context.Context) context.Context { |
no outgoing calls
no test coverage detected