Skip to content

Commit 7d13bbf

Browse files
statuscake: set correct content-type
For inserts and updates, the content-type is required. Since a little while ago, the statuscake stopped working when the content-type is missing. I validated this by replicating the request in cURL and ommitting the content-type. It indeed gave a 400 bad request. Apparently the Go HTTP client does not insert the correct content-type by itself.
1 parent b31dca6 commit 7d13bbf

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

‎pkg/monitors/statuscake/statuscake-monitor.go‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -627,6 +627,7 @@ func (service *StatusCakeMonitorService) Add(m models.Monitor) {
627627
return
628628
}
629629
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", service.apiKey))
630+
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
630631
resp, err := service.doRequest(req)
631632
if err != nil {
632633
log.Error(err, "Unable to make HTTP call")
@@ -701,6 +702,7 @@ func (service *StatusCakeMonitorService) Update(m models.Monitor) {
701702
return
702703
}
703704
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", service.apiKey))
705+
req.Header.Set("Content-Type", "application/x-www-form-urlencoded")
704706
resp, err := service.doRequest(req)
705707
if err != nil {
706708
log.Error(err, "Unable to make HTTP call")

0 commit comments

Comments
 (0)