add /_cat to list all of the other /_cat sub-endpoints

This commit is contained in:
Ryan Cavicchioni 2025-03-25 18:48:25 -05:00
parent d6b1ed1046
commit 312e570a02
Signed by: ryanc
SSH Key Fingerprint: SHA256:KbXiwUnZnHFwFtt3Bytd+F3FN9pPHn1Z1cxMIE1TPbg

14
app.rb
View File

@ -417,6 +417,20 @@ get "/config", provides: "json" do
jsonify config.as_json, pretty:
end
get "/_cat" do
stream do |out|
out << "=^.^=\n"
x = Sinatra::Application.routes.map do |method, route|
route.map do |route|
route.first.to_s
end
end
x.flatten.sort.uniq.each do |route|
out << "#{route}\n" if route.start_with? "/_cat"
end
end
end
get "/_cat/headers" do
stream do |out|
req_headers.each do |k, v|