1

I have msw setup to mock a GET and POST endpoint by returning a static constant object.

[
   rest.get("/something", (r, w, c) => 
       w(
          c.body({ ... })
       )
   ),
   rest.post("/something", (r, w, c) => 
       w(
          c.body({ status: "ok", entity: ... }))
       )
]

Is there a way to maintain state such that a subsequent GET will return whatever I POSTed? Not sure if it's a proper use case for msw since this is basically a server.

radix
  • 53
  • 1
  • 5

0 Answers0