Openstatus www.openstatus.dev

🔥 small improvment (#1004)

authored by

Thibault Le Ouay and committed by
GitHub
57c316fb d006fde3

+12 -10
+12 -10
apps/checker/ping.go
··· 69 69 region := os.Getenv("FLY_REGION") 70 70 71 71 b := []byte(inputData.Body) 72 - for _, header := range inputData.Headers { 73 - if header.Key == "Content-Type" && header.Value == "application/octet-stream" { 72 + if inputData.Method == http.MethodPost { 73 + for _, header := range inputData.Headers { 74 + if header.Key == "Content-Type" && header.Value == "application/octet-stream" { 74 75 75 - // split the body by comma and convert it to bytes 76 - data := strings.Split(inputData.Body, ",") 77 - if len(data) == 2 { 76 + // split the body by comma and convert it to bytes 77 + data := strings.Split(inputData.Body, ",") 78 + if len(data) == 2 { 78 79 79 - decoded, err := base64.StdEncoding.DecodeString(data[1]) 80 - if err != nil { 81 - return PingData{}, fmt.Errorf("error while decoding base64: %w", err) 82 - } 80 + decoded, err := base64.StdEncoding.DecodeString(data[1]) 81 + if err != nil { 82 + return PingData{}, fmt.Errorf("error while decoding base64: %w", err) 83 + } 83 84 84 - b = decoded 85 + b = decoded 85 86 87 + } 86 88 } 87 89 } 88 90 }