Skip to content

Commit

Permalink
feat: supports fetch.bypassingCache option value is RegExp (closes
Browse files Browse the repository at this point in the history
  • Loading branch information
qq15725 committed Sep 10, 2023
1 parent 67589ab commit 936581c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ export function contextFetch(context: Context, options: ContextFetchOptions) {
// cache bypass so we dont have CORS issues with cached images
// ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache
if (bypassingCache) {
url += (/\?/.test(url) ? '&' : '?') + new Date().getTime()
if (bypassingCache instanceof RegExp && bypassingCache.test(url)) {
url += (/\?/.test(url) ? '&' : '?') + new Date().getTime()
}
}

const baseFetchOptions: BaseFetchOptions = {
Expand Down
2 changes: 1 addition & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export interface Options {
*
* default: false
*/
bypassingCache?: boolean
bypassingCache?: boolean | RegExp

/**
* A data URL for a placeholder image that will be used when fetching
Expand Down

1 comment on commit 936581c

@vercel
Copy link

@vercel vercel bot commented on 936581c Sep 10, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

modern-screenshot – ./

modern-screenshot-qq15725.vercel.app
modern-screenshot-git-main-qq15725.vercel.app
modern-screenshot.vercel.app

Please sign in to comment.