github.com/prebid/prebid-server/v2@v2.18.0/adapters/response.go (about) 1 package adapters 2 3 import ( 4 "fmt" 5 "net/http" 6 7 "github.com/prebid/prebid-server/v2/errortypes" 8 ) 9 10 func CheckResponseStatusCodeForErrors(response *ResponseData) error { 11 if response.StatusCode == http.StatusBadRequest { 12 return &errortypes.BadInput{ 13 Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), 14 } 15 } 16 17 if response.StatusCode != http.StatusOK { 18 return &errortypes.BadServerResponse{ 19 Message: fmt.Sprintf("Unexpected status code: %d. Run with request.debug = 1 for more info", response.StatusCode), 20 } 21 } 22 23 return nil 24 } 25 26 func IsResponseStatusCodeNoContent(response *ResponseData) bool { 27 return response.StatusCode == http.StatusNoContent 28 }