WithNonce constructs a *http.Request which has a nonce attached.
(r *http.Request)
| 39 | |
| 40 | // WithNonce constructs a *http.Request which has a nonce attached. |
| 41 | func WithNonce(r *http.Request) (*http.Request, string) { |
| 42 | nonce := GenerateNonce() |
| 43 | return r.WithContext(context.WithValue(r.Context(), nonceKey, nonce)), nonce |
| 44 | } |
| 45 | |
| 46 | // ContentSecurityPolicy contains the Content Security Policy. |
| 47 | type ContentSecurityPolicy struct { |
no test coverage detected