spy-debugger/lib/util/httpUtil.js
2016-08-18 13:38:49 +08:00

19 lines
570 B
JavaScript

'use strict';
var os = require('os');
var url = require('url');
var config = require('../config/config');
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 = function (host) {
return !!~host.indexOf(':');
};