Skip to content

Commit

Permalink
chore: rename to isCommonAssetRequest
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Feb 24, 2025
1 parent bc24bb7 commit e0ef55b
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export * from './HttpResponse'
export * from './delay'
export { bypass } from './bypass'
export { passthrough } from './passthrough'
export { isAssetRequest } from './isAssetRequest'
export { isCommonAssetRequest } from './isCommonAssetRequest'

// Validate environmental globals before executing any code.
// This ensures that the library gives user-friendly errors
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@
* static assets by creating request handlers for them.
*
* @example
* import { isAssetRequest } from 'msw'
* import { isCommonAssetRequest } from 'msw'
*
* await worker.start({
* onUnhandledRequest(request, print) {
* if (!isAssetRequest(request)) {
* if (!isCommonAssetRequest(request)) {
* print.warning()
* }
* }
* })
*/
export function isAssetRequest(request: Request): boolean {
export function isCommonAssetRequest(request: Request): boolean {
const url = new URL(request.url)

// Ignore certain protocols.
Expand Down
4 changes: 2 additions & 2 deletions src/core/utils/request/onUnhandledRequest.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { toPublicUrl } from './toPublicUrl'
import { InternalError, devUtils } from '../internal/devUtils'
import { isAssetRequest } from '../../isAssetRequest'
import { isCommonAssetRequest } from '../../isCommonAssetRequest'

export interface UnhandledRequestPrint {
warning(): void
Expand Down Expand Up @@ -75,7 +75,7 @@ export async function onUnhandledRequest(
// Ignore common static asset requests when using a built-in strategy.
// There's a slight overhead here because this utility will create a request URL
// instance again despite us having done so previously in this function.
if (!isAssetRequest(request)) {
if (!isCommonAssetRequest(request)) {
applyStrategy(strategy)
}
}

0 comments on commit e0ef55b

Please sign in to comment.