Skip to content

Commit

Permalink
[DEX-2295] improvement: rename "proxy_http_verb" to "proxy_http_method"
Browse files Browse the repository at this point in the history
  • Loading branch information
shatalov-boris committed May 31, 2024
1 parent 0b6099c commit 70d8b57
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/)
and this project adheres to [Semantic Versioning](http://semver.org/).

## [0.x.0] - 2024-05-xx

### Changed
- rename "proxy_http_verb" to "proxy_http_method"

## [0.6.0] - 2024-05-30

### Added
Expand Down
5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ To determine the proxy mode, you need to:

controller.action("index") do |action|
action.proxy_url = "http://example.com:8080/api/hello"
action.proxy_http_verb = :post
action.proxy_http_method = :post
end
end
```
Expand All @@ -58,7 +58,7 @@ Sbmt::Strangler.configure do |strangler|

controller.action("index") do |action|
action.proxy_url = "http://example.com:8080/api/hello"
action.proxy_http_verb = :post
action.proxy_http_method = :post

# new implementation of legacy system business logic
action.mirror = ->(rails_controller) do
Expand All @@ -84,4 +84,3 @@ end


To enable replacement mode, use the feature flag. Replacement mode uses mirror lambda for replacement logic.

3 changes: 2 additions & 1 deletion lib/sbmt/strangler/action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ class Action
extend Sbmt::Strangler::Configurable

option :params_tracking_allowlist, :headers_allowlist, :flipper_actor, default_from: :controller
option :proxy_url, :proxy_http_verb
option :proxy_url
option :proxy_http_method, default: :get
option :mirror, default: ->(_rails_controller) {}
option :compare, default: ->(_origin_result, _mirror_result) { false }

Expand Down
2 changes: 1 addition & 1 deletion lib/sbmt/strangler/mixin.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def allowed_headers
def http_request(payload)
http_client.call(
proxy_url,
strangler_action.proxy_http_verb,
strangler_action.proxy_http_method,
payload: payload,
headers: allowed_headers
)
Expand Down
4 changes: 1 addition & 3 deletions spec/internal/config/initializers/strangler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module Orders

controller.action("index") do |action|
action.proxy_url = "http://example.com:8080/api/stores"
action.proxy_http_verb = :post
action.proxy_http_method = :post
action.mirror = ->(_rails_controller) do
{json: '["mirror_result"]', status: :ok}
end
Expand All @@ -22,15 +22,13 @@ module Orders

controller.action("show") do |action|
action.proxy_url = lambda { |params, _headers| "http://example.com:8080/api/stores/#{params[:id]}" }
action.proxy_http_verb = :get
action.params_tracking_allowlist = %w[id]
end
end

strangler.controller("api/orders/checkout") do |controller|
controller.action("index") do |action|
action.proxy_url = "http://example.com:8080/api/stores"
action.proxy_http_verb = :get
end
end
end

0 comments on commit 70d8b57

Please sign in to comment.