Openstatus www.openstatus.dev

๐Ÿš€ add body data (#961)

authored by

Thibault Le Ouay and committed by
GitHub
e771b72a bdcd519a

+11
+11
apps/checker/ping.go
··· 231 231 return Response{}, fmt.Errorf("error with monitorURL %s: %w", inputData.URL, err) 232 232 } 233 233 defer res.Body.Close() 234 + body, err := io.ReadAll(res.Body) 235 + 236 + if err != nil { 237 + return Response{ 238 + Latency: latency, 239 + Timing: timing, 240 + Time: start.UTC().UnixMilli(), 241 + Error: fmt.Sprintf("Cannot read response body: %s", err.Error()), 242 + }, fmt.Errorf("error with monitorURL %s: %w", inputData.URL, err) 243 + } 234 244 235 245 headers := make(map[string]string) 236 246 for key := range res.Header { ··· 243 253 Headers: headers, 244 254 Timing: timing, 245 255 Latency: latency, 256 + Body: string(body), 246 257 }, nil 247 258 }