@nathanfaucett/request
Version:
http requests for the browser and node.js
19 lines (14 loc) • 374 B
JavaScript
module.exports = parseContentType;
function parseContentType(str) {
var index;
if (str) {
if ((index = str.indexOf(";")) !== -1) {
str = str.substring(0, index);
}
if ((index = str.indexOf(",")) !== -1) {
return str.substring(0, index);
}
return str;
}
return "application/octet-stream";
}