草庐IT

Invalid_Request

全部标签

ruby - 如何在 Roo (Rails) : invalid byte sequence in UTF-8 中编码 csv 文件

我正在尝试上传一个csv文件,但收到UTF-8中的无效字节序列错误。我正在使用“roo”gem。我的代码是这样的:defupload_results_csvfilespreadsheet=MyFileUtil.open_file(file)header=spreadsheet.row(1)#THISLINERAISESTHEERROR(2..spreadsheet.last_row).eachdo|i|row=Hash[[header,spreadsheet.row(i)].transpose]......endclassMyFileUtildefself.open_file(file

Ruby,如何创建一个 Rack::Request 用于测试目的?

我有一个库,它接受一个Rack::Request并在其上做一些事情。我想通过单元测试而不是功能测试来测试它。所以我必须自己创建一个Rack::Request实例,我该怎么做? 最佳答案 Rack本身包含一些针对Rack::Request的单元测试,您可以将它们用作起点(example)。Rack::Request.new(Rack::MockRequest.env_for("http://example.com:8080/",{"REMOTE_ADDR"=>"10.10.10.10"}))

ruby - Jekyll 服务 "Error: Invalid argument"问题

我目前正在运行在我的Windows7PC上本地安装和生成Jekyll站点的阶段。我已经安装了所有要求并且可以让Jekyll启动,但我无法让它提供服务。每当我尝试时,它都会返回以下错误:$jekyllserve-tConfigurationfile:c:/wamp/www/ShaunYearStrong.github.io/_config.ymlSource:c:/wamp/www/ShaunYearStrong.github.ioDestination:c:/wamp/www/ShaunYearStrong.github.io/_siteGenerating...c:/Ruby193/

ruby-on-rails - Rails SSL 问题 : (https://example. com) 与 request.base_url (http ://example. com) 不匹配

我刚刚在我的网站上安装了SSL证书。不幸的是,它破坏了登录功能。在网站上提交登录表单后,它只是重定向到主页。检查Rails日志显示此错误:(https://example.com)didn'tmatchrequest.base_url(http://example.com)这是我的虚拟主机文件。我想我需要以某种方式强制使用SSL?ServerNameexample.comServerAliaswww.example.comRedirectpermanent/https://example.com/ServerAdminhello@example.comServerNameexample

ruby-on-rails - pdf-writer-1.1.8/lib/pdf/writer.rb :712: invalid multibyte char (US-ASCII)

我正在使用rubyversion1.9.3并且在启动thinserver时出现错误/usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.12.4/lib/bundler/runtime.rb:100:in`require':/usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-1.1.8/lib/pdf/writer.rb:712:invalidmultibytechar(US-ASCII)(SyntaxError)/usr/local/lib/ruby/gems/1.9.1/gems/pdf-writer-

ruby-on-rails - 为自定义 omniauth 策略获取 "Authentication failure! invalid_credentials: OAuth2::Error"

目前我正在处理Rails4项目,现在我必须链接/连接另一个应用程序(不是sso,而是用于访问API),比如example.com。(注意example.com使用三足式oauth安全架构)搜索后发现必须要实现omniouth策略。为此我引用了this关联。根据Strategy-Contribution-Guide我能够完成设置和请求阶段,您可以在此处找到我的示例代码。require'multi_json'require'omniauth/strategies/oauth2'require'uri'moduleOmniAuthmoduleStrategiesclassMyAppStrat

ruby 1.9.2 : irb throws ArgumentError: invalid byte sequence in UTF-8 when entering German Umlaut

我想在我的irb中输入德语变音符号,但出现奇怪的错误。我可以毫无问题地输入äöü的任何字符,但是每个ÄÖÜß都会导致以下错误:$irbruby-1.9.2-p136:001>?#hereIenteredÜbutitdisplaysonly?/Users/lorenz/.rvm/rubies/ruby-1.9.2-p136/lib/ruby/1.9.1/irb/ruby-lex.rb:728:in`blockinlex_int2':invalidbytesequenceinUTF-8(ArgumentError)我已经查看了很多关于Ruby、rvm和UTF-8的SO问题,但都没有帮助。大

ruby-on-rails - 处理身份登录的 OmniAuth::Error (invalid_credentials)

我使用OmniAuthIdentity进行正常登录。Rails3.2.3和Ruby1.9.3p194。目前,当现有用户尝试使用无效凭据登录时,我会收到以下错误:StartedPOST"/auth/identity/callback"for127.0.0.1at2012-07-1217:00:03-0400(identity)Callbackphaseinitiated.IdentityLoad(0.1ms)SELECT"identities".*FROM"identities"WHERE"identities"."email"='test'LIMIT1(identity)Authent

ruby-on-rails - Google 跨客户端授权和 invalid_grant 错误

我目前正在开发用于GoogleApi跨客户端授权的Web组件,如本文所述。https://developers.google.com/identity/protocols/CrossClientAuth此外,我所处的环境是Rails,因此我正在使用本文中描述的google-api-clientgemhttps://developers.google.com/identity/protocols/OAuth2WebServer#handlingtheresponse授权代码是通过Android应用程序使用Web客户端ID获取的,并传递到WebAPI以进行交换。我使用gem和代码兑换如下a

【uniapp】uni.request请求跨域问题解决方案

例如,运行H5页面,请求一个地址资源,如果不是本站地址,浏览器就会报跨域错误,这样访问受限问题呈现例如,项目代码里是这样写的,运行H5测试uni.request({ url:'https://gitcode.net/zs1028/stat...ouces_2023/-/...', success(res){ console.log(res) }, fail(err){ console.error(err) }})因为https://gitcode.net不是本站地址,根据浏览器同源策略,是会报跨域错误,解决步骤打开项目的manifest.json文件,以源码视图查看,添加以下代码{ //.