Closed Kdecherf closed 2 years ago
Could you please add some context – what is the purpose of this? If it is for tests, would not it be cleaner to mock httpClient
?
@jtojnar I worked a few weeks ago on a WebScrapBook server implementation in wallabag, it lets me save actual page content from my browser using the extension WebScrapBook which is useful for pages with javascript rendering or bot protection.
This implies to send content to Graby without it to make a HTTP call, thus adding support for "prefetched content".
This PR is ready for review I think, poke @jtojnar @j0k3r
Looks good to me, could you add an entry in the readme about that new behavior?
@j0k3r https://github.com/j0k3r/graby/pull/274/commits/7aa0592609ddfaabaa69f5efb5788b09f154fbbc do you think it's enough?
fetchContent() now accepts an optional parameter, prefetchedContent, which can contain the content of a page that was fetched outside of Graby.
If we take the example of Wallabag it gives the ability to send the content of a page (through a browser extension for example) without making network calls to fetch the actual page.