enjoycoding / vite-plugin-mock-server

A mock server plugin for Vite.
MIT License
58 stars 13 forks source link

How set statusCode? #25

Closed maximzhurkin closed 11 months ago

maximzhurkin commented 1 year ago

please add ability to set status code for responses

reinerBa commented 11 months ago

Thats already included, there is a hint in line 137 in the index.ts

res.statusCode = 404

Example

  {
    pattern: '/api/test1/1',
    handle: (req, res) => {
      res.statusCode = 404
      res.end('Hello world!' + req.url)
    }
  },