You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.3 KiB
57 lines
1.3 KiB
package libutil
|
|
|
|
import (
|
|
"net/http"
|
|
)
|
|
|
|
func ReturnCode(code int) (returnCode int) {
|
|
switch code {
|
|
case 0:
|
|
returnCode = http.StatusOK
|
|
case -1:
|
|
returnCode = http.StatusBadRequest
|
|
case -99:
|
|
returnCode = http.StatusUnauthorized
|
|
case -401:
|
|
returnCode = http.StatusUnauthorized
|
|
case 50:
|
|
returnCode = http.StatusInternalServerError
|
|
case 51:
|
|
returnCode = http.StatusUnprocessableEntity
|
|
case 52:
|
|
returnCode = http.StatusInternalServerError
|
|
case 53:
|
|
returnCode = http.StatusInternalServerError
|
|
case 54:
|
|
returnCode = http.StatusInternalServerError
|
|
case 55:
|
|
returnCode = http.StatusInternalServerError
|
|
case 56:
|
|
returnCode = http.StatusInternalServerError
|
|
case 57:
|
|
returnCode = http.StatusInternalServerError
|
|
case 58:
|
|
returnCode = http.StatusInternalServerError
|
|
case 59:
|
|
returnCode = http.StatusInternalServerError
|
|
case 60:
|
|
returnCode = http.StatusBadRequest
|
|
case 61:
|
|
returnCode = http.StatusUnauthorized
|
|
case 62:
|
|
returnCode = http.StatusMethodNotAllowed
|
|
case 63:
|
|
returnCode = http.StatusTooManyRequests
|
|
case 64:
|
|
returnCode = http.StatusInternalServerError
|
|
case 65:
|
|
returnCode = http.StatusNotFound
|
|
case 66:
|
|
returnCode = http.StatusMethodNotAllowed
|
|
case 300:
|
|
returnCode = http.StatusUnprocessableEntity
|
|
default:
|
|
returnCode = code
|
|
}
|
|
return
|
|
}
|
|
|