-
Notifications
You must be signed in to change notification settings - Fork 16
/
type-is.node.txt
24 lines (17 loc) · 2 KB
/
type-is.node.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
TYPE-IS
VERSION ==> #1.6.19
TYPEIS.is('MIME',STR[_ARR]...)#Returns first STR that matches 'MIME'
->STR|false #STR can be:
# - "MIME/SUBTYPE", including using *
# - "PATH" or "[.]EXT": using MIMETYPES.lookup() (see its doc)
# - 'urlencoded' -> 'application/x-www-form-urlencoded'
# - 'multipart' -> 'multipart/*'
# - '+...' -> '*/*+...'
#Returns false is no match
#'MIME' is normalized by using MEDIATYPER.parse() then MEDIATYPER.format() (see its doc)
TYPEIS(REQ, STR[_ARR]...) #Like TYPEIS.is(...), except:
# - uses REQ.headers['content-type']
# - returns false if TYPEIS.hasBody(REQ) false
TYPEIS.hasBody(REQ)->BOOL #Check Transfer-Encoding [C] and Content-Length [C]