mswjs / interceptors

Low-level network interception library.
https://npm.im/@mswjs/interceptors
MIT License
535 stars 120 forks source link

feat: replaced "uuid" with "crypto.randomUUID()" (#470) #471

Closed biplobsd closed 10 months ago

biplobsd commented 10 months ago

I have deleted all uuid and used crypto.randomUUID(). I also deleted uuid file for is being unused function.

Fixed : #470

biplobsd commented 10 months ago

Hello @kettanaito, is there any changes needed? 😐

hpohlmeyer commented 10 months ago

Just saw this PR and wanted to note, that this makes @mswjs/interceptors incompatible with browsers. If I remember correctly, msw uses the interceptors library to defer request execution until the service worker has been registered.

node:crypto is not available in browsers, so this would break compatibility. But even using crypto.randomUUID() without the import breaks compatibility, if it is used on a http site, because crypto is only available on https sites.

biplobsd commented 10 months ago

Just saw this PR and wanted to note, that this makes @mswjs/interceptors incompatible with browsers. If I remember correctly, msw uses the interceptors library to defer request execution until the service worker has been registered.

node:crypto is not available in browsers, so this would break compatibility. But even using crypto.randomUUID() without the import breaks compatibility, if it is used on a http site, because crypto is only available on https sites.

Okay, I'm close this PR. @hpohlmeyer . This changes make more problem 😄