Skip to content

Commit

Permalink
added status code
Browse files Browse the repository at this point in the history
  • Loading branch information
cateiru committed Aug 8, 2021
1 parent 3cba232 commit 6fc1fc1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions status.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,18 @@ func ErrorResponse(w http.ResponseWriter, statusCode int, err error) {
ErrorResponse(w, 1, err)
}

switch statusCode {
case 1:
ErrorStatus(w)
break
case 2:
w.WriteHeader(http.StatusUnauthorized)
break
default:
ErrorStatus(w)
break
}

w.Header().Set("Content-Type", "application/json")
w.Write(responseText)
}

0 comments on commit 6fc1fc1

Please sign in to comment.