Open heruiwoniou opened 2 years ago
The status code will be overwritten When you use res.send
to return data. https://github.com/xuxihai123/vite-plugin-mockit/blob/62354174f1/middleware/response.js#L34
The code snippet you provided is a solution. You can also do the following:
res.status(404); // or res.statusCode=404
res.end('data string');
I want to response a 404 result, but
res.status(404)
don't work;Update:
For now, I'm using the original method to this problem: