我试图改变依赖于变量的代码过程,req
你可以在这里看到:
@res = @conn.post do |request| if req == 'post'
@res = @conn.get do |request| if req == 'get'
问题是这似乎引发了一个错误:
stack.rb:89: syntax error, unexpected end-of-input, expecting keyword_end
user2.send_csr
我的问题是,我必须改变什么来避免这个问题?如果您需要有关我的代码的更多信息:
def send(req,ww,text1=nil,text2=nil)
@conn = Faraday.new 'https://zombo.de/rest', :ssl => {:verify => false}
@conn.basic_auth(@username,@password)
@res = @conn.post do |request| if req == 'post'
@res = @conn.get do |request| if req == 'get'
request.url ww
request.headers['Content-Type'] = text1 unless text1 == nil
request.body = text2 unless text2 == nil
end
puts @res.body
end
def send_csr
send('post','csr','text/plain',"#{File.read(@csr[0..-5])}")
end
user2.send_csr