2017-04-22 22:49:49 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
const make = require('../make')
|
|
|
|
const random = require('../random')
|
|
|
|
|
|
|
|
class mime extends make {
|
|
|
|
static any () {
|
2017-04-24 15:02:50 +00:00
|
|
|
return random.pick([
|
2018-03-19 03:23:05 +00:00
|
|
|
this.standard,
|
|
|
|
this.xml,
|
|
|
|
this.image,
|
|
|
|
this.media,
|
|
|
|
this.form
|
2017-04-25 22:21:31 +00:00
|
|
|
])
|
2018-03-19 03:23:05 +00:00
|
|
|
}
|
2017-04-25 22:21:31 +00:00
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
static standard () {
|
2017-04-22 22:49:49 +00:00
|
|
|
return random.pick([
|
2017-04-25 22:21:31 +00:00
|
|
|
'text/html',
|
|
|
|
'text/html; charset=utf-8',
|
|
|
|
'text/plain',
|
|
|
|
'text/css',
|
|
|
|
'text/javascript',
|
|
|
|
'foo/bar',
|
|
|
|
'application/octet-stream',
|
|
|
|
'application/x-shockwave-flash',
|
|
|
|
'application/x-test'
|
|
|
|
])
|
2018-03-19 03:23:05 +00:00
|
|
|
}
|
2017-04-24 15:02:50 +00:00
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
static xml () {
|
2017-04-24 15:02:50 +00:00
|
|
|
return random.pick([
|
2017-04-25 22:21:31 +00:00
|
|
|
'application/xml',
|
|
|
|
'text/xml',
|
|
|
|
'application/xhtml+xml',
|
|
|
|
'image/svg+xml',
|
|
|
|
'application/vnd.mozilla.xul+xml',
|
|
|
|
'application/rss+xml',
|
|
|
|
'application/rdf+xml',
|
|
|
|
'application/xslt+xml'
|
|
|
|
])
|
2018-03-19 03:23:05 +00:00
|
|
|
}
|
2017-04-24 15:02:50 +00:00
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
static image () {
|
2017-04-24 15:02:50 +00:00
|
|
|
return random.pick([
|
2017-04-25 22:21:31 +00:00
|
|
|
'image/jpeg',
|
|
|
|
'image/gif',
|
|
|
|
'image/png',
|
|
|
|
'image/mng',
|
|
|
|
'image/*'
|
|
|
|
])
|
2018-03-19 03:23:05 +00:00
|
|
|
}
|
2017-04-24 15:02:50 +00:00
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
static media () {
|
2017-04-24 15:02:50 +00:00
|
|
|
return random.pick([
|
2017-04-25 22:21:31 +00:00
|
|
|
'audio/mpeg',
|
|
|
|
'audio/ogg',
|
|
|
|
'audio/ogg; codecs=vorbis',
|
|
|
|
'video/ogg',
|
|
|
|
'video/ogg; codecs="theora, vorbis"',
|
|
|
|
'video/mp4',
|
|
|
|
'video/mp4; codecs="avc1.42E01E, mp4a.40.2"'
|
|
|
|
])
|
2018-03-19 03:23:05 +00:00
|
|
|
}
|
2017-04-24 15:02:50 +00:00
|
|
|
|
2018-03-19 03:23:05 +00:00
|
|
|
static form () {
|
2017-04-24 15:02:50 +00:00
|
|
|
return random.pick([
|
2017-04-25 22:21:31 +00:00
|
|
|
'application/x-www-form-urlencoded',
|
|
|
|
'multipart/form-data',
|
|
|
|
'text/plain'
|
|
|
|
])
|
|
|
|
}
|
|
|
|
}
|
2018-03-19 03:23:05 +00:00
|
|
|
|
|
|
|
module.exports = mime
|