Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppHarborClient.GetHostnames throws ArgumentNullException #19

Open
duncansmart opened this issue Mar 11, 2013 · 0 comments
Open

AppHarborClient.GetHostnames throws ArgumentNullException #19

duncansmart opened this issue Mar 11, 2013 · 0 comments

Comments

@duncansmart
Copy link
Contributor

I have a simple test application enumerates sites and their hostnames:

static void apitest()
{
    var authInfo = new AuthInfo(ACCESS_TOKEN);
    var ah = new AppHarborClient(authInfo);
    foreach (var application in ah.GetApplications())
    {
        Console.WriteLine("----");
        Console.WriteLine(application.Name);
        Console.WriteLine(application.Slug);
        Console.WriteLine(application.Url);

        var hostnames = ah.GetHostnames(application.Slug);
        foreach (var hostname in hostnames)
        {
            Console.WriteLine(" * " + hostname.Id);
            Console.WriteLine(" * " + hostname.Value);
            Console.WriteLine(" * " + hostname.Url);
            Console.WriteLine(" * " + hostname.Canonical);
        }
    }
}

It blow ups at GetHostnames:

Test 'M:AppHarborTest.Program.apitest' failed: Value cannot be null.
Parameter name: url
    System.ArgumentNullException: Value cannot be null.
    Parameter name: url
    AppHarborClient.cs(184,0): at AppHarbor.AppHarborClient.CheckArgumentNull(String argumentName, Object value)
    AppHarborClient.cs(51,0): at AppHarbor.AppHarborClient.ExtractId(Uri url)
    AppHarborClient.cs(103,0): at AppHarbor.AppHarborClient.ExecuteGetListKeyed[T](RestRequest request)
    AppHarborClient.Hostname.cs(29,0): at AppHarbor.AppHarborClient.GetHostnames(String applicationSlug)
    Program.cs(50,0): at AppHarborTest.Program.apitest()

The failing code is in: AppHarborClient.ExecuteGetListKeyed:

    foreach (var item in data)
    {
        item.Id = ExtractId(item.Url);
    }

ExtractId() is throwing on a null URL.

Looking at the traffic over fiddler:

GET https://appharbor.com/applications/my-slug/hostnames

Returns:

[
  {
    "value": "my-site.example.com",
    "canonical": false,
    "url": "https://appharbor.com/applications/my-slug/hostnames/3456"
  },
  {
    "value": "my-slug.apphb.com",
    "canonical": false,
    "url": null
  }
]

Looking at the others it seems for the default apphb URLs that url us always null.

duncansmart referenced this issue in duncansmart/AppHarbor.NET Mar 11, 2013
duncansmart added a commit to duncansmart/AppHarbor.NET that referenced this issue Mar 12, 2013
runesoerensen added a commit that referenced this issue Mar 27, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant