You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
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:
The text was updated successfully, but these errors were encountered:
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
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 toclient.GetPage
, I get anInvalidOperationException
with this message:No creator found for com.gargoylesoftware.htmlunit.UnexpectedPage
This was reported against HtmlUnit itself on SO about five years ago.
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:
The text was updated successfully, but these errors were encountered: