From d5d72e7421f8e5f4ba278d813821ce07e89d49e1 Mon Sep 17 00:00:00 2001 From: Cory Jacobsen Date: Thu, 21 May 2020 16:10:28 -0600 Subject: [PATCH] Fix #70 - avoid panic with error check --- secure.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/secure.go b/secure.go index 9a0ac5c..a326899 100644 --- a/secure.go +++ b/secure.go @@ -250,6 +250,10 @@ func (s *Secure) Process(w http.ResponseWriter, r *http.Request) error { // In addition, the generated nonce for the request is returned as well as the error value. func (s *Secure) ProcessAndReturnNonce(w http.ResponseWriter, r *http.Request) (string, error) { responseHeader, newR, err := s.processRequest(w, r) + if err != nil { + return "", err + } + addResponseHeaders(responseHeader, w) return CSPNonce(newR.Context()), err