How to integrate msw with Dynamics 365 #2139
Unanswered
IrynaJuriivna
asked this question in
Q&A
Replies: 1 comment
-
Hi, @IrynaJuriivna. I don't have any experience with Dynamics 365 but one thing I can suggest you check is the scope of your worker. For example, based on the info you've posted, MSW can only intercept requests from the pages under the
While the worker will be registered for the entire app, its scope equals to the path at which the worker was served. That's the Service Worker API behavior not specific to MSW. If you want MSW to intercept requests from all pages in your app, you have two options:
await worker.start({
serviceWorker: {
options: {
scope: '/' // force the scope to be root
}
}
}) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello Everyone, I hope you are doing well.
I`m trying to intercept requests in Dynamics365 using the MSWJS library.
I uploaded it as WebResources 3 separate files:
I added HTML WebResource to the form. It references the file that registers the ServiceWorker like this:
<script src="../scripts/TestMockServiceWorker.js"></script>On the form load, I have in the Console the following message:
So when I call the request from the react button from this HTML webResource component, ServiceWorker works as expected.
But when I try to make the same request from another JavaScript WebResource - it doesn`t.
Could you tell me please if anyone ever tried to integrate Dynamics 365 with Service Worker and suggest how to do this? Is it possible to integrate MSW with Dynamics 365?
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions