Skip to content

Commit

Permalink
Fix outgoing example URL in API backend form not containing right host.
Browse files Browse the repository at this point in the history
  • Loading branch information
GUI committed Apr 21, 2017
1 parent e18e43d commit b4ce3e2
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default Ember.Component.extend({
}),

exampleOutgoingUrl: Ember.computed('bufferedModel.frontendPrefix', 'bufferedModel.backendPrefix', function() {
let root = this.get('apiExampleIncomingUrlRoot') || '';
let root = this.get('apiExampleOutgoingUrlRoot') || '';
let prefix = this.get('bufferedModel.backendPrefix') || this.get('bufferedModel.frontendPrefix') || '';
return root + prefix + this.get('exampleSuffix');
}),
Expand Down
6 changes: 3 additions & 3 deletions src/api-umbrella/admin-ui/app/models/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ export default DS.Model.extend(Validations, {
},

exampleIncomingUrlRoot: Ember.computed('frontendHost', function() {
return 'http://' + (this.get('frontendHost') || '');
return 'https://' + (this.get('frontendHost') || '');
}),

exampleOutgoingUrlRoot: Ember.computed('backendHost', function() {
return 'http://' + (this.get('backendHost') || this.get('frontendHost') || '');
exampleOutgoingUrlRoot: Ember.computed('backendProtocol', 'backendHost', 'fontendHost', function() {
return this.get('backendProtocol') + '://' + (this.get('backendHost') || this.get('frontendHost') || '');
}),
}).reopenClass({
urlRoot: '/api-umbrella/v1/apis',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{apis/url-match-form model=urlMatchModel collection=model.urlMatches apiExampleIncomingUrlRoot=model.exampleIncomingUrlRoot openModal=openModal}}
{{apis/url-match-form model=urlMatchModel collection=model.urlMatches apiExampleIncomingUrlRoot=model.exampleIncomingUrlRoot apiExampleOutgoingUrlRoot=model.exampleOutgoingUrlRoot openModal=openModal}}

<div id="url_matches">
<table id="url_matches_table" class="table table-striped table-condensed">
Expand Down
4 changes: 3 additions & 1 deletion test/admin_ui/test_apis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def test_form
assert_selector(".modal")
within(".modal") do
fill_in "Host", :with => "google.com"
fill_in "Port", :with => "443"
assert_field("Port", :with => "443")
click_button("OK")
end

Expand All @@ -130,6 +130,8 @@ def test_form
within(".modal") do
fill_in "Frontend Prefix", :with => "/foo"
fill_in "Backend Prefix", :with => "/bar"
assert_text("Incoming Frontend Request: https://api.foo.com/fooexample.json?param=value")
assert_text("Outgoing Backend Request: https://api.bar.com/barexample.json?param=value")
click_button("OK")
end

Expand Down

0 comments on commit b4ce3e2

Please sign in to comment.