This supports scenarios where the GHE instance is behind a proxy that interferes with normal API functionality (e.g. authenticates with OAuth). In order to use the API when GHE is behind a proxy like that, you need to hit it using a different (internal) hostname. However, as of version 11.10.280, GHE redirects all non-canonical hostname requests to the canonical version. This breaks using a different hostname for API requests. This commit enables access using a different hostname by overriding the Host header so that GHE does not perform the redirect.
Main fix is in Request#request -- just strips the leading slash. I also removed the leading slashes in existing calls. I had considered doing this in spec/helper.rb, but couldn't get a good error message. module Octokit::Request alias :request_without_assert :request def request(method, path, options, version, authenticate, raw, force_urlencoded) path.start_with?('/').should == false #will fail in github:enterprise request_without_assert(method, path, options, version, authenticate, raw, force_urlencoded) end end