Skip to content

Commit 6fc1fc1

Browse files
committed
added status code
1 parent 3cba232 commit 6fc1fc1

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

status.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ func ErrorResponse(w http.ResponseWriter, statusCode int, err error) {
2424
ErrorResponse(w, 1, err)
2525
}
2626

27+
switch statusCode {
28+
case 1:
29+
ErrorStatus(w)
30+
break
31+
case 2:
32+
w.WriteHeader(http.StatusUnauthorized)
33+
break
34+
default:
35+
ErrorStatus(w)
36+
break
37+
}
38+
2739
w.Header().Set("Content-Type", "application/json")
2840
w.Write(responseText)
2941
}

0 commit comments

Comments
 (0)