@whook/whook
Version:
Build strong and efficient REST web services.
28 lines • 969 B
JavaScript
import Stream from 'node:stream';
import qs from 'qs';
export const DEFAULT_DEBUG_NODE_ENVS = ['test', 'development'];
export const DEFAULT_BUFFER_LIMIT = '500kB';
export const DEFAULT_PARSERS = {
'application/json': (content) => JSON.parse(content),
'text/plain': (content) => content,
'application/x-www-form-urlencoded': (content) => qs.parse(content),
};
export const DEFAULT_STRINGIFIERS = {
'application/json': (content) => JSON.stringify(content),
'text/plain': ensureString,
'application/x-www-form-urlencoded': (content) => qs.stringify(content),
};
export const DEFAULT_DECODERS = {
'utf-8': Stream.PassThrough,
};
export const DEFAULT_ENCODERS = {
'utf-8': Stream.PassThrough,
};
function ensureString(maybeString) {
return 'undefined' === typeof maybeString
? ''
: 'string' === typeof maybeString
? maybeString
: JSON.stringify(maybeString);
}
//# sourceMappingURL=constants.js.map