mirror of
https://github.com/wuchangming/spy-debugger.git
synced 2026-01-18 14:29:45 +00:00
18 lines
496 B
JavaScript
18 lines
496 B
JavaScript
'use strict'
|
|
|
|
const os = require('os');
|
|
|
|
var httpUtil = exports;
|
|
|
|
httpUtil.isGzip = function (res) {
|
|
var contentEncoding = res.headers['content-encoding'];
|
|
return !!(contentEncoding && contentEncoding.toLowerCase() == 'gzip');
|
|
}
|
|
httpUtil.isHtml = function (res) {
|
|
var contentType = res.headers['content-type'];
|
|
return (typeof contentType != 'undefined') && /text\/html|application\/xhtml\+xml/.test(contentType);
|
|
}
|
|
httpUtil.hasPort = (host) => {
|
|
return !!~host.indexOf(':');
|
|
};
|