为什么此代码会响应请求,而不支持以下代码?
---------------------------支持这些----------------- --------
app.put('/dishes/:dishId', (req, res, next) => {
res.write('Updating the dish: ' + req.params.dishId + '\n');
res.end('Will update the dish: ' + req.body.name +
' with details: ' + req.body.description);
});
app.post('/dishes', (req, res, next) => {
res.end('Will add the dish: ' + req.body.name + ' with details: ' + req.body.description);
});
---------------------------不支持这些---------------- --------
app.put('/dishes', (req, res, next) => {
res.statusCode = 403;
res.end('PUT operation not supported on /dishes');
});
app.post('/dishes/:dishId', (req, res, next) => {
res.statusCode = 403;
res.end('POST operation not supported on /dishes/'+ req.params.dishId);
});