-
Notifications
You must be signed in to change notification settings - Fork 16
/
method-override.express.txt
15 lines (11 loc) · 1.74 KB
/
method-override.express.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
METHOD-OVERRIDE
METHOD-OVERRIDE #Express MIDWR (3.0.0) that changes REQ.method.
([STR|FUNC(REQ,RES)->METHOD # - If STR "X-..." (def: "X-HTTP-Method-Override"), METHOD = header
[, OBJ]]) # - Otherwise METHOD = REQ.query.STR
# - METHOD-OVERRIDE() can be use()'d several times to allow several headers|query params.
#If OBJ.methods METHOD_ARR, this MIDWR only work if current REQ.method matches any of them.
#Should be uppercase, and def. is "POST" (keep it for security reason).
#Should be included before any Express MIDWR that needs to know REQ.method, basically just
#after logging MIDWR.