bosondata / chrome-prerender

Render JavaScript-rendered page as HTML/PDF/mhtml/png/jpeg using Headless Chrome
MIT License
165 stars 20 forks source link

beforeSend plugin #16

Open knuhol opened 7 years ago

knuhol commented 7 years ago

Is there any option how to use something like beforeSend(req, res, next) plugin from NodeJS prerender or is there any plan to add this feature?

I need to modify both request and response because:

messense commented 7 years ago

chrome-prerender isn't designed as a library, it's an application. beforeSend isn't really applicable to an application. To support all the things you want, we need to redesign it to make it work as a library.

To disable cache, you can set environment var CACHE_BACKEND=dummy.

knuhol commented 7 years ago

To disable cache, you can set environment var CACHE_BACKEND=dummy.

Thanks, but it doesn't work for me (still getting response 304 instead of 200).

messense commented 7 years ago

@akarienta chrome-prerender will try to get the requested url's status code if possible. You got 304 means Chrome got 304 for that url.

https://github.com/bosondata/chrome-prerender/blob/master/prerender/chromerdp.py#L427