Skip to content

chialin/react-msw-example

Repository files navigation

GitHub License

Example of Simulating API Requests Locally with MSW

Purpose

  1. How to set up MSW (Mock Service Worker).
  2. Resolve issues where MSW cannot intercept API requests properly.

MSW Version

MSW 2.0
https://mswjs.io/docs/getting-started

Error Message

Uncaught (in promise) SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON

Reference Links

使用 MSW 在本地端模擬 API request 範例

目的

  1. 如何設定 MSW (Mock Service Worker)
  2. 解決 MSW 無法正確攔截 API request

MSW 版本

MSW 2.0 https://mswjs.io/docs/getting-started

錯誤訊息

Uncaught (in promise) SyntaxError: Unexpected token '<', "<!doctype "... is not valid JSON

參考連結

About

Example of Simulating API Requests Locally with MSW

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published