From b8c1fb41a1f7b717ea92fc5c2863b12ed2abc090 Mon Sep 17 00:00:00 2001 From: Yura Pakhuchiy Date: Sat, 21 Oct 2017 14:17:51 +0700 Subject: [PATCH] Allow to serve static files as response to POST Sometimes it is useful to serve static answers to POST requests. However ecstatic rejects all requests except GET or HEAD. This small patch fixes it. --- lib/ecstatic.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/ecstatic.js b/lib/ecstatic.js index 8849c6c..cfaaaf4 100644 --- a/lib/ecstatic.js +++ b/lib/ecstatic.js @@ -221,7 +221,7 @@ module.exports = function createMiddleware(_dir, _options) { return; } - if (req.method && (req.method !== 'GET' && req.method !== 'HEAD')) { + if (req.method && (req.method !== 'GET' && req.method !== 'HEAD' && req.method !== 'POST')) { status[405](res, next); return; }