Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP


Add support for subdomains in test_helper requests #232

merged 2 commits into from

2 participants


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 . . .

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


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?


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

@dj2 dj2 merged commit 29742a3 into from

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
4 lib/goliath/test_helper.rb
@@ -178,9 +178,11 @@ def options_request(request_data = {}, errback = nil, &blk)
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) || {}
-"http://localhost:#{@test_server_port}#{path}", opts)
+"http://#{domain}#{path}", opts)
Something went wrong with that request. Please try again.