mirror of
https://github.com/steveiliop56/tinyauth.git
synced 2025-10-28 12:45:47 +00:00
refactor: change error to 500 when there is an error
This commit is contained in:
@@ -140,11 +140,11 @@ func (api *API) SetupRoutes() {
|
|||||||
|
|
||||||
// Handle error
|
// Handle error
|
||||||
if authEnabledErr != nil {
|
if authEnabledErr != nil {
|
||||||
// Return 501 if nginx is the proxy or if the request is using basic auth
|
// Return 500 if nginx is the proxy or if the request is using basic auth
|
||||||
if proxy.Proxy == "nginx" || basicAuth {
|
if proxy.Proxy == "nginx" || basicAuth {
|
||||||
log.Error().Err(authEnabledErr).Msg("Failed to check if auth is enabled")
|
log.Error().Err(authEnabledErr).Msg("Failed to check if auth is enabled")
|
||||||
c.JSON(501, gin.H{
|
c.JSON(500, gin.H{
|
||||||
"status": 501,
|
"status": 500,
|
||||||
"message": "Internal Server Error",
|
"message": "Internal Server Error",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
@@ -185,11 +185,11 @@ func (api *API) SetupRoutes() {
|
|||||||
|
|
||||||
// Check if there was an error
|
// Check if there was an error
|
||||||
if appAllowedErr != nil {
|
if appAllowedErr != nil {
|
||||||
// Return 501 if nginx is the proxy or if the request is using basic auth
|
// Return 500 if nginx is the proxy or if the request is using basic auth
|
||||||
if proxy.Proxy == "nginx" || basicAuth {
|
if proxy.Proxy == "nginx" || basicAuth {
|
||||||
log.Error().Err(appAllowedErr).Msg("Failed to check if app is allowed")
|
log.Error().Err(appAllowedErr).Msg("Failed to check if app is allowed")
|
||||||
c.JSON(501, gin.H{
|
c.JSON(500, gin.H{
|
||||||
"status": 501,
|
"status": 500,
|
||||||
"message": "Internal Server Error",
|
"message": "Internal Server Error",
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
|
|||||||
Reference in New Issue
Block a user