From 443828ceed4b097918d819cff6a493cb7444e753 Mon Sep 17 00:00:00 2001 From: Martin Bjeldbak Madsen Date: Sat, 27 Aug 2022 09:36:07 +0000 Subject: [PATCH] Check error code of Write --- commands/auth.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/commands/auth.go b/commands/auth.go index 3ee6e94..1f89d8a 100644 --- a/commands/auth.go +++ b/commands/auth.go @@ -52,7 +52,12 @@ var authCmd = &cobra.Command{ w.WriteHeader(http.StatusNotFound) return } - w.Write(file) + _, err = w.Write(file) + if err != nil { + fmt.Printf("Error writing to response: %v", err) + w.WriteHeader(http.StatusNotFound) + return + } }) if err := http.ListenAndServe(fmt.Sprintf(":%v", localCallbackPort), nil); err != nil {