ruby-on-rails – Rails控制台启动“显示所有573种可能性? (y或
发布时间:2020-12-17 03:31:31 所属栏目:百科 来源:网络整理
导读:我将以下代码片段从我的文本编辑器复制到我的rails控制台: request = Typhoeus::Request.new("https://track.customer.io/api/v1/customers/4",ssl_verifypeer: false,method: :put,headers: { "Content-Type" = "application/json","User-Agent" = "#{Rail
我将以下代码片段从我的文本编辑器复制到我的rails控制台:
request = Typhoeus::Request.new( "https://track.customer.io/api/v1/customers/4",ssl_verifypeer: false,method: :put,headers: { "Content-Type" => "application/json","User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},body: '{ "email":"first@last.com","name":"Name is here","id":"4","created_at":"#{Time.now}"}') 当我将它全部复制为一行时: request = Typhoeus::Request.new("https://track.customer.io/api/v1/customers/4",headers: {"Content-Type" => "application/json",body: '{"email":"first@last.com","created_at":"#{Time.now}"}') 然后控制台返回标准响应: => #<Typhoeus::Request:0x00000101c517a8 @base_url="https://track.customer.io/api/v1/customers/4",@original_options=... 但是,如果我逐行复制它(就像我在第一个代码片段中所做的那样),我会收到一个奇怪的错误.控制台询问我是否要显示所有可能性,就像我正在搜索目录或在粘贴中途进行搜索查询一样.看看这个: 1.9.3p393 :091 > request = Typhoeus::Request.new( 1.9.3p393 :092 > "https://track.customer.io/api/v1/customers/4",1.9.3p393 :093 > ssl_verifypeer: false,1.9.3p393 :094 > method: :put,1.9.3p393 :095 > headers: { 1.9.3p393 :096 > Display all 573 possibilities? (y or n) 1.9.3p393 :096 > "Content-Type" => "application/json",1.9.3p393 :097 > Display all 573 possibilities? (y or n) 1.9.3p393 :097 > "User-Agent" => "#{Rails.configuration.customerio[:site_id]}:#{Rails.configuration.customerio[:api_key]}"},1.9.3p393 :098 > body: '{ 1.9.3p393 :099'> "email":"first@last.com",1.9.3p393 :100'> "name":"Name is here",1.9.3p393 :101'> "id":"4",1.9.3p393 :102'> "created_at":"#{Time.now}"}') 如果我两次都选择n,则正常创建请求.但是,如果我选择y,它会列出573个项目,其中大部分是我放入这个贴图:http://pastie.org/private/ksgzqhd50mvdi0t6cqe8g 你知道这些结果是什么吗,更重要的是,为什么在这个奇怪的时间被提示? 解决方法
听起来像你正在复制代码的源有两个制表符,其中“Content-Type”…和“User-Agent”…是缩进的.两个制表符将调用控制台中的自动完成列表(您看到的提示是当可能的完成次数超过某个阈值时).
请注意,如果您从自己的StackOverflow帖子中复制并粘贴它,则不应该看到自动完成提示,因为它使用空格来缩进而不是制表符. 编辑: 要确认我的怀疑,请在编辑器中打开“显示空白”,以查看这两行的开头是否有制表符. 个人意见:如果您还没有这样做,我建议您配置编辑器为Tab键按下插入空格.标签是魔鬼的空白:). (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |