Comparing version
Baucis Change Log | ||
================= | ||
v0.6.18 | ||
------- | ||
Fixes issue #72. The `Location` header is now only set for POST responses. | ||
This fixes the related issue of response headers being too large when doing | ||
GET requests that return a large number of documents. | ||
v0.6.17 | ||
@@ -5,0 +12,0 @@ ------- |
@@ -57,2 +57,5 @@ // __Dependencies__ | ||
// If it's not a POST, send now because Location shouldn't be set. | ||
if (request.method !== 'POST') return response.json(documents); | ||
// Otherwise, set the location and send JSON document(s). Don't set location if documents | ||
@@ -76,5 +79,4 @@ // don't have IDs for whatever reason e.g. custom middleware. | ||
if (location) response.set('Location', location); | ||
response.json(documents); | ||
} | ||
}; |
@@ -5,3 +5,3 @@ { | ||
"homepage": "https://github.com/wprl/baucis", | ||
"version": "0.6.17", | ||
"version": "0.6.18", | ||
"main": "index.js", | ||
@@ -8,0 +8,0 @@ "scripts": { |
@@ -1,2 +0,2 @@ | ||
baucis v0.6.17 | ||
baucis v0.6.18 | ||
============== | ||
@@ -3,0 +3,0 @@ |
@@ -50,2 +50,15 @@ var expect = require('expect.js'); | ||
it('should not set Location header', function (done) { | ||
var options = { | ||
url: 'http://localhost:8012/api/v1/vegetables/6', | ||
json: true | ||
}; | ||
request.get(options, function (error, response, body) { | ||
if (error) return done(error); | ||
expect(response.headers).not.to.have.property('location'); | ||
console.log(response.headers); | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -28,2 +28,26 @@ var expect = require('expect.js'); | ||
}); | ||
it('should not set Location header', function (done) { | ||
var options = { | ||
url: 'http://localhost:8012/api/v1/vegetables', | ||
json: true | ||
}; | ||
request.get(options, function (error, response, body) { | ||
if (error) return done(error); | ||
expect(response.headers).not.to.have.property('location'); | ||
done(); | ||
}); | ||
}); | ||
it('should use JSON content type', function (done) { | ||
var options = { | ||
url: 'http://localhost:8012/api/v1/vegetables', | ||
json: true | ||
}; | ||
request.get(options, function (error, response, body) { | ||
if (error) return done(error); | ||
expect(response.headers).to.have.property('content-type', 'application/json; charset=utf-8'); | ||
done(); | ||
}); | ||
}); | ||
}); |
@@ -32,6 +32,7 @@ var expect = require('expect.js'); | ||
expect(response).to.have.property('statusCode', 200); | ||
expect(response.headers.location).to.equal('/api/v1/vegetables/' + radicchio._id); | ||
expect(response.headers).to.not.have.property('location'); | ||
var leekId = radicchio._id; | ||
var options = { | ||
url: 'http://localhost:8012' + response.headers.location, | ||
url: 'http://localhost:8012/api/v1/vegetables/' + leekId, | ||
json: true | ||
@@ -38,0 +39,0 @@ }; |
Sorry, the diff of this file is not supported yet
561326
0.2%2915
1.29%