-
-
Save roni5/037e4c521338425f24e1f78d8b8dc5df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // src/mocks/handlers.js | |
| import { rest } from "msw"; | |
| export const handlers = [ | |
| // Handles a POST request | |
| rest.post("https://fancy-app.com/postToThisEndpoint", (req, res, ctx) => { | |
| return res( | |
| // Respond with a 200 status code | |
| ctx.status(200) | |
| ); | |
| }), | |
| // Handles a GET request | |
| rest.get("https://fancy-app.com/getSomeData", (req, res, ctx) => { | |
| return res( | |
| ctx.status(200), | |
| ctx.json({ | |
| data: "fancy data string", | |
| }) | |
| ); | |
| }), | |
| ]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment