mirror of
https://github.com/fooflington/selfdefined.git
synced 2025-06-12 05:31:41 +00:00
update
This commit is contained in:
35
node_modules/browser-sync-ui/lib/utils.js
generated
vendored
Normal file
35
node_modules/browser-sync-ui/lib/utils.js
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
var url = require("url");
|
||||
var http = require("http");
|
||||
|
||||
/**
|
||||
* @param localUrl
|
||||
* @param urlPath
|
||||
* @returns {*}
|
||||
*/
|
||||
function createUrl(localUrl, urlPath) {
|
||||
return url.parse(url.resolve(localUrl, urlPath));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param url
|
||||
* @param cb
|
||||
*/
|
||||
function verifyUrl(url, cb) {
|
||||
|
||||
url.headers = {
|
||||
"accept": "text/html"
|
||||
};
|
||||
|
||||
http.get(url, function (res) {
|
||||
if (res.statusCode === 200) {
|
||||
cb(null, res);
|
||||
} else {
|
||||
cb("not 200");
|
||||
}
|
||||
}).on("error", function(e) {
|
||||
console.log("Got error: " + e.message);
|
||||
});
|
||||
}
|
||||
|
||||
module.exports.createUrl = createUrl;
|
||||
module.exports.verifyUrl = verifyUrl;
|
Reference in New Issue
Block a user