【发布时间】:2020-08-13 08:12:15
【问题描述】:
这是我的faxattach.rb 代码:
require 'sinatra'
require 'docsplit'
require './sinatra/faxattach_helpers'
class FaxAttach < Sinatra::Base
helpers Sinatra::FaxAttachHelpers
get '/*' do
"hello world"
status 405
end
put '/*' do
status 405
end
patch '/*' do
status 405
end
delete '/*' do
status 405
end
options '/*' do
status 405
end
link '/*' do
status 405
end
unlink '/*' do
status 405
end
post '/process' do
path = params[:path]
begin
debugger
file = test_download path
rescue
status 404
end
debugger
code = extractCode file
code
end
end
我正在使用 curl curl --data "path=URL_HERE" localhost:4567/process 对 /process 进行发布请求,但由于某种原因,我得到了:Sinatra doesn't know this ditty。它告诉我输入一个post /process,我显然有。
有什么想法吗?
【问题讨论】:
-
Sinatra: Route Handlers Inside a Class - Access other Class Methods 的可能副本。您需要一个
config.ru文件来指定要运行的类。