Signed-off-by: Oliver Davies <oliver@oliverdavies.uk>
This commit is contained in:
Oliver Davies 2025-09-23 00:43:16 +01:00
parent 3713d774ec
commit 6157443144
2 changed files with 3 additions and 3 deletions

View file

@ -15,13 +15,13 @@ func GetPort() string {
return "8080"
}
func GetResponseCode(r *http.Request) int {
func GetStatusCode(r *http.Request) int {
// If the `force-fail` header is set, get and return its value.
if failCode := r.Header.Get("force-fail"); failCode != "" {
log.Println("`force-fail` header set...")
if code, err := strconv.Atoi(failCode); err == nil {
log.Printf("Setting the response code to %d...", code)
log.Printf("Setting the status code to %d...", code)
return code
}