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

No creator found for com.gargoylesoftware.htmlunit.UnexpectedPage (JSON response) #19

Open
ashes999 opened this issue Oct 13, 2015 · 1 comment

Comments

@ashes999
Copy link

I'm trying to write a functional test for an MVC5 + Web API project where I log in (via web forms), and then make a POST call directly to the API route. When I make the call to client.GetPage, I get an InvalidOperationException with this message: No creator found for com.gargoylesoftware.htmlunit.UnexpectedPage

This was reported against HtmlUnit itself on SO about five years ago.

var client = new WebClient(BrowserVersion.CHROME);
 var method = new HttpMethod(com.gargoylesoftware.htmlunit.HttpMethod.POST);
var json = JsonConvert.SerializeObject(inputObject);

var webRequest = new WebRequest(new java.net.URL("http://localhost/site/api/game"), new HttpMethod(method))
{
    RequestBody = "=" + json // WebAPI expects this. Don't ask me why.
};
var page = client.GetPage(webRequest);

I can see the call hit the server side (including the response object which comes back) -- it's not throwing an exception there, only on the client. The response is pure JSON:

{
    "Data": [
        {
            "Id": "00000000-0000-0000-0000-000000000000",
            "Name": "FT-FunctionalTestGame",
            "OwnerId": 3
        }
    ],
    "Errors": null
}
@ashes999 ashes999 changed the title No creator found for com.gargoylesoftware.htmlunit.UnexpectedPage No creator found for com.gargoylesoftware.htmlunit.UnexpectedPage (JSON response) Oct 14, 2015
@asbjornu
Copy link
Member

I wouldn't expect this project to receive an update before IKVM is ported to .NET Core. See #35 for details.

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

2 participants