Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat capture service worker resources #1434

Closed
wants to merge 4 commits into from

Conversation

nilshah98
Copy link
Contributor

@nilshah98 nilshah98 commented Nov 17, 2023

Changes:

  • Set bypass: false for Network.setBypassServiceWorker so that service-worker controller can be added and we can access the MSW mocks customer has added.
  • Added serviceWorker parameter, to handleRequests that are not intercepted (since service worker intercepted and will resolve them)

ToDo:

  • Add other checks to verify if a request has been intercepted by service-worker before adding to requests queue

Detailed Changes & Reasoning:

  • Added Network.setBypassServiceWorker to bypass: false so that we can add service-worker controller and access service worker that mocks customer's data.
  • Initially tried to access service-worker requests using Network.getResponseBody, but over here body is returned as "" (empty string) randomly.
    • Tried to look on the internet about why this happens, but no luck :(
  • Finally, decided to call Network.getResponseBody on the original request which service-worker intercepted.
    • Network.getResponseBody is same as what appears in the Response tab in Network section in devtools.
    • For requests that were intercepted by service-worker, the Response tab is always populated.
    • But the service-worker which makes the request upstream or returns mocked data randomly returns body: "" when Network.getResponseBody is called on it.
    • Hence, relying on calling Network.getResponseBody on the original request itself.

@nilshah98
Copy link
Contributor Author

Closing, since this is covered in #1443

@nilshah98 nilshah98 closed this Nov 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant