Skip to content

Commit

Permalink
🔥 small improvment (#1004)
Browse files Browse the repository at this point in the history
  • Loading branch information
thibaultleouay authored Sep 14, 2024
1 parent d006fde commit 57c316f
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions apps/checker/ping.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,20 +69,22 @@ func Ping(ctx context.Context, client *http.Client, inputData request.CheckerReq
region := os.Getenv("FLY_REGION")

b := []byte(inputData.Body)
for _, header := range inputData.Headers {
if header.Key == "Content-Type" && header.Value == "application/octet-stream" {
if inputData.Method == http.MethodPost {
for _, header := range inputData.Headers {
if header.Key == "Content-Type" && header.Value == "application/octet-stream" {

// split the body by comma and convert it to bytes
data := strings.Split(inputData.Body, ",")
if len(data) == 2 {
// split the body by comma and convert it to bytes
data := strings.Split(inputData.Body, ",")
if len(data) == 2 {

decoded, err := base64.StdEncoding.DecodeString(data[1])
if err != nil {
return PingData{}, fmt.Errorf("error while decoding base64: %w", err)
}
decoded, err := base64.StdEncoding.DecodeString(data[1])
if err != nil {
return PingData{}, fmt.Errorf("error while decoding base64: %w", err)
}

b = decoded
b = decoded

}
}
}
}
Expand Down

0 comments on commit 57c316f

Please sign in to comment.