Is there a way to handle a GET request on Sinatra and make a PATCH request with a different body on the same server? User makes a request GET /clean_beautiful_api
and server redirects it to PATCH /dirty/clogged_api_url_1?crap=2 "{request_body: 1}"
?
I want to clean up legacy API without interfering with the functionality.
If I've understood correctly, the easiest way is to extract the block used for the
patch
into a helper:to:
Or you could use a lambda…
the main thing is to extract the method to somewhere else and then call it.
Edit: You can also trigger another route internally using the Rack interface via
call
.