The actual snapshot is saved in parser.js.snap
.
Generated by AVA.
parser("content-disposition: inline; filename=example.pdf")
{
filename: 'example.pdf',
type: 'inline',
}
parser("content-disposition: form-data; name=\"field2\"; filename=\"example.txt\"")
{
filename: 'example.txt',
name: 'field2',
type: 'form-data',
}
parser("Content-Disposition: attachment; FileName=\"A LiTTle 'sTrAnge'.fileName\"")
{
filename: 'A LiTTle \'sTrAnge\'.fileName',
type: 'attachment',
}
parser("Content-Disposition: Attachment; Filename*=UTF-8'en'an%20example")
{
encoding: 'utf-8',
filename: 'an example',
type: 'attachment',
}
parser("Content-Disposition: attachment; filename*= UTF-8''%E2%82%B4%20rates")
{
encoding: 'utf-8',
filename: '₴ rates',
type: 'attachment',
}
parser("Content-Disposition: attachment; filename=\"EURO rates\"; filename*=utf-8''%e2%82%ac%20rates")
{
encoding: 'utf-8',
filename: '€ rates',
type: 'attachment',
}
parser("Content-Disposition: attachment; filename*=utf-8''%24%20rates; filename=\"USD rates\"")
{
encoding: 'utf-8',
filename: '$ rates',
type: 'attachment',
}
parser("inline; filename=example.txt")
{
filename: 'example.txt',
type: 'inline',
}
parser("attachment; filename=\"oїÃ¡Ã¨kа.jpg\"")
{
filename: 'oїÃ¡Ã¨kа.jpg',
type: 'attachment',
}
parser("attachment; filename=oїÃ¡Ã¨kа.jpg")
{
filename: 'oїÃ¡Ã¨kа.jpg',
type: 'attachment',
}
parser("inline; filename*=iso-8859-1")
{
encoding: 'iso-8859-1',
type: 'inline',
}
parser("inline; filename*=iso-8859-1'en'%C3%A9xampl%C3%A9.txt")
{
encoding: 'iso-8859-1',
filename: 'éxamplé.txt',
type: 'inline',
}
parser("inline; filename*=iso-8859-1''26738271 svoboda")
{
encoding: 'iso-8859-1',
filename: '26738271 svoboda',
type: 'inline',
}
parser("googleit=8{; filename=\"26738271 svoboda\"; filename*=utf-8''%D1%83%D0%B1%D0%B8%D0%B9%20%D1%83%20%D1%81%D0%BE%D0%B1%D1%96%20%D1%81%D0%B2%D0%BE%D0%B1%D0%BE%D0%B4%D0%B0")
{
encoding: 'utf-8',
filename: 'убий у собі свобода',
type: 'googleit=8{',
}
parse("Any string will be parsed as Content-Disposition type")
{
type: 'any string will be parsed as content-disposition type',
}
parse("String will semicolons; will be parsed as properties; like; it=is a valid; content=disposition ; sic!;")
{
content: 'disposition',
it: 'is a valid',
like: true,
'sic!': true,
type: 'string will semicolons',
'will be parsed as properties': true,
}
parse("")
undefined
parse(";")
undefined
parse("; string with leading semicolon")
{
type: 'string with leading semicolon',
}
parse(null)
undefined
parse(undefined)
undefined
parse(false)
undefined
parse(true)
undefined
parse(0)
undefined
parse(1)
undefined
parse(-1)
undefined
parse(NaN)
undefined
parse(Infinity)
undefined
parse([])
undefined
parse({})
undefined
parse(function () {})
undefined
parse(function Date() { [native code] })
undefined