Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Add support for subdomains in test_helper requests #232

Merged
merged 2 commits into from

2 participants

@kybishop

The current test_helper only allows requests straight to localhost. This change adds support for subdomains in the request_data hash of the various request methods

with_api(MyAwesomeAPI) do
  get_request(:subdomain => 'notifications.') do . . .
@kybishop

Alternatively, I'd be happy to write up a commit that allows you to change the domain entirely (instead of just prepending a subdomain)

@dj2
Owner

This looks pretty good. Although, to your comment I think having the ability to change the localhost:post to something user defined maybe the better solution. Can you change the patch over to pass :domain and replacing the localhost:port with the provided domain if it's present?

@kybishop

Let me know how that looks, happy to make changes.

@dj2 dj2 merged commit 29742a3 into from
@dj2
Owner

Merged. Thanks a lot for the patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 3 additions and 1 deletion.
  1. +3 −1 lib/goliath/test_helper.rb
View
4 lib/goliath/test_helper.rb
@@ -178,9 +178,11 @@ def options_request(request_data = {}, errback = nil, &blk)
end
def create_test_request(request_data)
+ domain = request_data.delete(:domain) || "localhost:#{@test_server_port}"
path = request_data.delete(:path) || ''
opts = request_data.delete(:connection_options) || {}
- EM::HttpRequest.new("http://localhost:#{@test_server_port}#{path}", opts)
+
+ EM::HttpRequest.new("http://#{domain}#{path}", opts)
end
private
Something went wrong with that request. Please try again.