From 5f9d175027958da10cdeb9121924f062bffe3bc1 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Mon, 7 Feb 2022 09:40:05 -0500 Subject: [PATCH] Support JSON route pre-limits This will allow us to switch asterisk to the new logic before rolling out the limits. Asterisk will then support the limits once sgx-jmp begins instructing it about them. --- web.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web.rb b/web.rb index 6dcaaaa82d8a71e7579804f9ccca8b74a90c7902..bd1ba56973cea5cb72f49cd8d2cf1789018424f5 100644 --- a/web.rb +++ b/web.rb @@ -49,6 +49,7 @@ class Web < Roda use Rack::Fiber unless ENV["ENV"] == "test" # Must go first! use Sentry::Rack::CaptureExceptions plugin :json_parser + plugin :type_routing plugin :public plugin :render, engine: "slim" plugin RodaCapture @@ -279,6 +280,13 @@ class Web < Roda customer_repo( sgx_repo: Bwmsgsv2Repo.new ).find_by_format(from).then do |c| + r.json do + { + from: c.registered?.phone, + to: params["to"] + }.to_json + end + render :forward, locals: { from: c.registered?.phone, to: params["to"]