-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
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
}
Metadata
Metadata
Assignees
Labels
No labels