mod_http_oauth2: Tweak fallback error text
authorKim Alvefur <zash@zash.se>
Sat, 23 Dec 2023 00:01:30 +0100
changeset 5802 fdf3056021dc
parent 5801 03477980f1a9
child 5803 c75328aeaba3
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.
mod_http_oauth2/mod_http_oauth2.lua
--- 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