-
Notifications
You must be signed in to change notification settings - Fork 1
/
defaults.js
50 lines (43 loc) · 1.01 KB
/
defaults.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
var logger = require('bole')('agnostic');
// agnostic's default options
module.exports =
{
// default logger
logger: logger,
// request handling related options
request:
{
contentType : 'text/plain',
contentLength: 0,
bodyMaxLength: 1000 * 1024,
bodyEncoding : 'utf8'
},
response:
{
statusCode : 200,
contentType : 'text/plain'
},
// default parsing (as per `content-type` request header)
parsers:
{
'application/json': JSON.parse
},
// default stringifiers (as per `precise-typeof` classification)
stringifiers:
{
'object' : JSON.stringify,
'array' : JSON.stringify,
// send null as empty strings
'null' : '',
// send booleans as 0 or 1
'boolean' : function(b) { return b ? '1' : '0'; }
},
// default content types (as per `precise-typeof` classification)
contentMimeTypes:
{
'string': 'text/html',
'object': 'application/json',
'array' : 'application/json',
'buffer': 'application/octet-stream'
}
};