cmd(diagnostics): fix Content-Type and accept more status codes (#186)

This commit is contained in:
Daniel Barton 2024-04-17 05:15:19 +08:00 committed by GitHub
parent 1d5090957b
commit ec54371b86
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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
}