Logo
My Account |  Site Map | Contact Us  
Welcome Guest Search | Active Topics | Sign In | Register

How can I get response content? Options
Kobzar666
Posted: Tuesday, October 8, 2019 6:04:55 AM
Rank: Newbie
Groups: Member

Joined: 10/4/2019
Posts: 3
Hello, I'm using AfterReceiveHeadersEvent to get "application/json" response. I can get headers, contentType, statusCode etc. But how to get json content?
eo_support
Posted: Tuesday, October 8, 2019 10:04:48 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 21,607
Hi,

You will not be able to get the response contents directly from the browser engine because for most pages the browser engine never has the full response contents. This is because the browser engine is highly optimized and it parses the contents chunk by chunk as it receives them. Once a chunk of the raw contents data is parsed, it is immediately discarded.

If you must intercept the response contents, you can use a custom resource handler to fetch the resource in your own code in entirety, then pass this entire response down to the browser engine. Obviously this would have a negative impact on performance since it would lose both the key optimization step mentioned above, but also other optimizations by the loader layer. However it would allow you to inspect/modify the response since your code would have the response before the browser engine can have it.

See here for more details on custom resource handler:

https://www.essentialobjects.com/doc/webbrowser/advanced/resource_handler.aspx

Hope this helps.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.