Problems with Go Appengine endpoint tests
<p>I am trying to create an endpoint test when using appengine. Unfortunately, the tests keep failing because of the lack of a schema (and host) within the url used when creating the test <code>*Request</code> struct. When running appengine tests a server is spawned for that specific test that runs on a semi-random port number, which makes it seemingly impossible to define the full url to perform the test on.</p>

<p>The <a href="https://cloud.google.com/appengine/docs/go/tools/localunittesting/" rel="nofollow">official docs</a> on running tests like this are very sparse and only give half of an example, so I am left scratching my head on how to get this to work.</p>

<p>This is the error that I get from the marked line within the code snippet
<code>
Error: Received unexpected error "Post /auth: unsupported protocol scheme \"\""
</code></p>

<p><strong>Test Code</strong></p>

<pre><code>func TestEndpoints_Auth(t *testing.T) {

    // input data
    account := Account{
        AuthProvider:   "facebook",
        AuthProviderId: "123345456",
    }
    b, _ := json.Marshal(&amp;account)
    reader := bytes.NewReader(b)

    // test server
    inst, err := aetest.NewInstance(nil)
    if !assert.NoError(t, err) { return }
    defer inst.Close()

    // request
    client := http.Client{}
    req, err := inst.NewRequest("POST", "/auth", reader)
    if !assert.NoError(t, err) { return }
    req.Header.Add(AppAuthToken, "foobar")
    resp, err := client.Do(req)
    if !assert.NoError(t, err) { return }   // &lt;=== Where the error occurs

    // tests
    if !assert.Nil(t, err) { return }
    assert.Equal(t, http.StatusCreated, resp.StatusCode)
}
</code></pre>

<p>Logs
<code>
[GIN-debug] POST   /auth                     --&gt; bitbucket.org/chrisolsen/chriscamp.(*endpoints).Auth-fm (5 handlers)
[GIN-debug] GET    /accounts/me              --&gt; bitbucket.org/chrisolsen/chriscamp.(*endpoints).GetMyAccount-fm (7 handlers)
INFO     2016-04-22 13:23:39,278 devappserver2.py:769] Skipping SDK update check.
WARNING  2016-04-22 13:23:39,278 devappserver2.py:785] DEFAULT_VERSION_HOSTNAME will not be set correctly with --port=0
WARNING  2016-04-22 13:23:39,345 simple_search_stub.py:1126] Could not read search indexes from c:\users\chris\appdata\local\temp\appengine.testapp\search_indexes
INFO     2016-04-22 13:23:39,354 api_server.py:205] Starting API server at: http://localhost:54461
INFO     2016-04-22 13:23:41,043 dispatcher.py:197] Starting module "default" running at: http://localhost:54462
INFO     2016-04-22 13:23:41,046 admin_server.py:116] Starting admin server at: http://localhost:54466
</code></p>