diff mod_http_oauth2/mod_http_oauth2.lua @ 5798:fdf3056021dc

mod_http_oauth2: Tweak fallback error text Since the oauth error is more like the error condition, a symbolic error code, not the most human-friendly. Many error cases do have human-readable error descriptions that should be fine on their own, or changed to be. As a fallback, capitalize the error name.
author Kim Alvefur <zash@zash.se>
date Sat, 23 Dec 2023 00:01:30 +0100
parents 03477980f1a9
children c75328aeaba3
line wrap: on
line diff
--- a/mod_http_oauth2/mod_http_oauth2.lua	Thu Dec 21 18:26:42 2023 +0100
+++ b/mod_http_oauth2/mod_http_oauth2.lua	Sat Dec 23 00:01:30 2023 +0100
@@ -252,7 +252,7 @@
 		type = "modify";
 		condition = "bad-request";
 		code = err_name == "invalid_client" and 401 or 400;
-		text = err_desc and (err_name..": "..err_desc) or err_name;
+		text = err_desc or err_name:gsub("^.", string.upper):gsub("_", " ");
 		extra = { oauth2_response = { error = err_name, error_description = err_desc } };
 	});
 end