Skip to content

Latest commit

 

History

History
43 lines (25 loc) · 1.02 KB

File metadata and controls

43 lines (25 loc) · 1.02 KB

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

參考連結