From ec54371b86f17e7c124d66672afcadd214b25c86 Mon Sep 17 00:00:00 2001 From: Daniel Barton Date: Wed, 17 Apr 2024 05:15:19 +0800 Subject: [PATCH] cmd(diagnostics): fix `Content-Type` and accept more status codes (#186) --- cmd/diagnostics.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/diagnostics.go b/cmd/diagnostics.go index c7362e1..3fef9ee 100644 --- a/cmd/diagnostics.go +++ b/cmd/diagnostics.go @@ -229,8 +229,8 @@ func uploadToHastebin(hbUrl, content string) (string, error) { return "", err } u.Path = path.Join(u.Path, "documents") - res, err := http.Post(u.String(), "plain/text", r) - if err != nil || res.StatusCode != 200 { + res, err := http.Post(u.String(), "text/plain", r) + if err != nil || res.StatusCode < 200 || res.StatusCode >= 300 { fmt.Println("Failed to upload report to ", u.String(), err) return "", err }