Module: OliveBranchMiddlewareExtension
- Included in:
- OliveBranch::Middleware
- Defined in:
- lib/olive_branch_patch.rb
Overview
This will monkey patch olivebranch middleware github.com/vigetlabs/olive_branch/blob/master/lib/olive_branch/middleware.rb so that when the VA inflection changes a key like something_va_something, the results will have the old-inflection somethingVaSomething.
Instance Method Summary collapse
Instance Method Details
#call(env) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/olive_branch_patch.rb', line 8 def call(env) result = super(env) _status, headers, response = result # olive branch uses this private method to determine if a tranformation should happen https://github.com/vigetlabs/olive_branch/blob/master/lib/olive_branch/middleware.rb#L92 return result if send(:exclude_response?, env, headers) if env['HTTP_X_KEY_INFLECTION'] =~ /camel/i response.each do |json| un_camel_va_keys!(json) end end result end |