test undefined Accept-Encoding with head request
parent
04bb2a9f8f
commit
a4639fa638
|
@ -76,9 +76,18 @@ describe(__filename, function () {
|
|||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], undefined);
|
||||
assert.equal(isPlaintextResponse(res.text, resource), true);
|
||||
return;
|
||||
})));
|
||||
});
|
||||
|
||||
// need to use head here - cant unset Accept-Encoding in GET requests
|
||||
it('head request without Accept-Encoding header does not set Content-Encoding', async function () {
|
||||
await agent
|
||||
.head(packages[0])
|
||||
.then((res) => {
|
||||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], undefined);
|
||||
});
|
||||
});
|
||||
|
||||
it('gets packages compressed with Accept-Encoding gzip', async function () {
|
||||
await Promise.all(packages.map(async (resource) => await agent.get(resource)
|
||||
|
@ -88,7 +97,6 @@ describe(__filename, function () {
|
|||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], 'gzip');
|
||||
assert.equal(isPlaintextResponse(res.text, resource), false);
|
||||
return;
|
||||
})));
|
||||
});
|
||||
|
||||
|
@ -126,10 +134,19 @@ describe(__filename, function () {
|
|||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], undefined);
|
||||
assert.equal(isPlaintextResponse(res.text, resource), true);
|
||||
return;
|
||||
})));
|
||||
});
|
||||
|
||||
// need to use head here - cant unset Accept-Encoding in GET requests
|
||||
it('head request without Accept-Encoding header does not set Content-Encoding', async function () {
|
||||
await agent
|
||||
.head(packages[0])
|
||||
.then((res) => {
|
||||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], undefined);
|
||||
});
|
||||
});
|
||||
|
||||
it('gets packages compressed with Accept-Encoding gzip', async function () {
|
||||
await Promise.all(packages.map(async (resource) => await agent.get(resource)
|
||||
.set('Accept-Encoding', 'gzip')
|
||||
|
@ -138,7 +155,6 @@ describe(__filename, function () {
|
|||
assert.match(res.header['content-type'], /application\/javascript/);
|
||||
assert.equal(res.header['content-encoding'], 'gzip');
|
||||
assert.equal(isPlaintextResponse(res.text, resource), false);
|
||||
return;
|
||||
})));
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in New Issue