jasl / wx_pay

An unofficial simple wechat pay gem

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

非Symbol类型key会验证失败

destinyd opened this issue · comments

https://github.com/jasl/wx_pay/blob/master/lib/wx_pay/service.rb#L317

可否在验证的时候,考虑转换之后,再做验证?

传 symbol 应该是比较通常的做法吧,也可以使用 HashWithIndifferent 或者 hash.symbolize_keys 但我觉得没有必要,你在传入的时候自己用这两种方法处理下就好了

我是 hash.symbolize_keys 了,但是我觉得会有使用者以json或者其他形式传入吧?
例如我就是那么做了

你不应该这么做,func(arg1, arg2, ..., **options, &block) 是非常标准的 Rails 的函数声明风格