UNPKG

@whook/whook

Version:

Build strong and efficient REST web services.

28 lines 988 B
import { PassThrough } 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 = { 'text/plain': (content) => content, 'application/json': (content) => JSON.parse(content), 'application/x-www-form-urlencoded': (content) => qs.parse(content), }; export const DEFAULT_STRINGIFIERS = { 'text/plain': ensureString, 'application/json': (content) => JSON.stringify(content), 'application/x-www-form-urlencoded': (content) => qs.stringify(content), }; export const DEFAULT_DECODERS = { 'utf-8': () => new PassThrough(), }; export const DEFAULT_ENCODERS = { 'utf-8': () => new PassThrough(), }; function ensureString(maybeString) { return 'undefined' === typeof maybeString ? '' : 'string' === typeof maybeString ? maybeString : JSON.stringify(maybeString); } //# sourceMappingURL=constants.js.map