combo-url-parser
Advanced tools
Comparing version 0.2.3 to 0.2.4
@@ -12,3 +12,3 @@ var parser = require('./parser.js'); | ||
var headers = ['content-type', 'vary'].map(function (key) { | ||
var headers = ['content-type', 'vary', 'access-control-allow-origin'].map(function (key) { | ||
return [key, key.split('-').map(function (word) { | ||
@@ -59,3 +59,3 @@ return word[0].toUpperCase() + word.substr(1) | ||
if (err.message === '404') { | ||
err.statsCde = 404; | ||
err.statusCode = 404; | ||
res.end('Sorry, Can not found '+ err.url); | ||
@@ -78,7 +78,5 @@ } else { | ||
res.setHeader('Access-Control-Allow-Origin', '*'); | ||
var newline = new Buffer('\n'); | ||
res.end(Buffer.concat(results.reduce(function(all, result){ | ||
res.end(Buffer.concat(results.reduce(function(all, result) { | ||
if (all.length) { | ||
@@ -85,0 +83,0 @@ all.push(newline); |
@@ -5,3 +5,3 @@ { | ||
"description": "A util to parser comboed url", | ||
"version": "0.2.3", | ||
"version": "0.2.4", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
@@ -30,4 +30,4 @@ var request = require('request'); | ||
it('body has content', function () { | ||
expect(reqBody).to.be.ok(); | ||
expect(reqBody).to.be.a('string'); | ||
expect(reqBody).to.be.a('string') | ||
.and.to.have.length(413) | ||
}); | ||
@@ -60,9 +60,37 @@ }); | ||
it('body has content', function () { | ||
expect(reqBody).to.be.ok(); | ||
expect(reqBody).to.be.a('string'); | ||
expect(reqBody).to.be.a('string') | ||
.and.to.have.length(413); | ||
}); | ||
}); | ||
}); | ||
describe('g.tbcdn.cn', function () { | ||
var reqBody; | ||
before(function (done) { | ||
request({ | ||
uri: { | ||
hostname: '10.125.202.112', | ||
port: '', | ||
pathname: '/kissy/k/1.4.1/seed.js', | ||
protocol: 'http:' | ||
}, | ||
headers: { | ||
host: 't6l-tb-xcake-0-0-2.cdef.taobao.net', | ||
'user-agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.2 Safari/537.36' | ||
} | ||
}, function(err, req, body){ | ||
if (err) { | ||
done(err); | ||
return; | ||
} | ||
reqBody = body; | ||
done(); | ||
}); | ||
}); | ||
it('body has content', function () { | ||
expect(reqBody).to.be.a('string') | ||
.and.to.have.length(199420); | ||
}); | ||
}); | ||
}); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
8658
214