M README.md => README.md +1 -1
@@ 21,7 21,7 @@ const get = require('micro-get')
/*
- GET requests will execute the function
- - Non-GET requests will return HTTP Code 404
+ - Non-GET requests will return HTTP Code 405
*/
module.exports = get(async (req, res) => {
return send(res, 200, `It's a GET request!`)
M src/index.js => src/index.js +2 -2
@@ 6,8 6,8 @@ module.exports = exports = function (fn) {
return (req, res) => {
const {method} = req
if (method !== ALLOWED_HTTP_METHOD) {
- res.writeHead(404)
- res.end('Not Found.')
+ res.writeHead(405)
+ res.end('Method Not Allowed')
return
}
res.setHeader('Access-Control-Request-Method', ALLOWED_HTTP_METHOD)