I\'m trying to create a facade API that receives requests via Sinatra then launches HTTP requests on Github API in the backend.
In my \"hello world\" script I have:<
I found the reason. HTTPClient defines a module named HTTP
. By default Sinatra looks for Rack handlers with namespace names HTTP
and WEBrick
, in that order.
Since the HTTP
namespace has been defined Sinatra actually thinks it's a Rack handler. I think this is a bug in Sinatra. It should check if the handler responds to run
before using it.
Anyway the fix is to use Thin, or if you want to use WEBrick then explicitly tell Sinatra to skip the automatic Rack detection by doing:
set :server, 'webrick'
That will prevent Sinatra from thinking the HTTPClient HTTP
module is Rack handler.