Intercept and Mock Client-Side HTTP Requests in MSW

Share this video with your friends

Send Tweet

Request handlers you write in Mock Service Worker apply for both Node.js and the browser simultaneously. In this lesson, you will handle a client-side request for movie recommendations using the same http namespace you already know. We will also take a sneak peek at the browser's Network to see what happens to the requests when we mock them.

Toni Laukka
Toni Laukka
~ a year ago

I think this Recommendations part is missing from the source code...

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ a year ago

Hi, Toni! Thanks for pointing that out. A Git rebase issue. I've just pushed a fix.

Kushal Mahajan
Kushal Mahajan
~ a year ago

I cloned it today and Recommendations error is displayed. How should I resolve this rebase issue?

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ a year ago

Hey, Kushal. Note that the main branch of the repo contains the clean state of the project (before lesson #1). You are supposed to go through the lessons to add the handlers and resolve that recommendations error. Or you can jump straight to the completed state of the course (after the last lesson) by running git checkout completed. All the instructions are in the README, please see.

Kushal Mahajan
Kushal Mahajan
~ a year ago

Yeah, I am following along each lesson. If I switch to completed, I won't be able to code along. I think I found the issue. Can I submit a fix?

Kushal Mahajan
Kushal Mahajan
~ a year ago

Anyway, here's the PR for fix. https://github.com/kettanaito/movie-app/pull/1

Artem Zakharchenko
Artem Zakharchenko(instructor)
~ a year ago

Kushal, absolutely! Thanks, I will take a look and we will get to the bottom of this.