Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pkg/http/httpClient.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,10 @@ func (client *HttpClient) RequestWithHeaders(requestType string, body []byte, he
log.Error(err, "Failed to craft HTTP Request. METHOD: "+requestType+
" URL: "+client.url+
" PAYLOAD: "+string(body))
return HttpResponse{
StatusCode: http.StatusInternalServerError,
Header: make(http.Header),
}
}

if headers != nil {
Expand All @@ -50,8 +54,16 @@ func (client *HttpClient) RequestWithHeaders(requestType string, body []byte, he
response, err := http.DefaultClient.Do(request)
if err != nil {
log.Error(err, "")
return HttpResponse{
StatusCode: http.StatusInternalServerError,
Header: make(http.Header),
}
} else if response == nil {
log.Error(nil, "got empty response")
return HttpResponse{
StatusCode: http.StatusInternalServerError,
Header: make(http.Header),
}
}

httpResponse := HttpResponse{
Expand Down
Loading