Support up to 2mb requests

This commit is contained in:
James Allen 2014-05-13 12:54:58 +01:00
parent 0dda75c2d5
commit 79457227e1
2 changed files with 17 additions and 1 deletions

View file

@ -17,7 +17,7 @@ app.use Metrics.http.monitor(logger)
app.get '/project/:project_id/doc', HttpController.getAllDocs
app.get '/project/:project_id/doc/:doc_id', HttpController.getDoc
app.post '/project/:project_id/doc/:doc_id', bodyParser.json(), HttpController.updateDoc
app.post '/project/:project_id/doc/:doc_id', bodyParser.json(limit: "2mb"), HttpController.updateDoc
app.del '/project/:project_id/doc/:doc_id', HttpController.deleteDoc
app.get '/status', (req, res)->

View file

@ -95,3 +95,19 @@ describe "Applying updates to a doc", ->
doc.lines.should.deep.equal @originalLines
done()
describe "when the content is large", ->
beforeEach (done) ->
line = new Array(1025).join("x") # 1kb
@largeLines = Array.apply(null, Array(1024)).map(() -> line) # 1mb
DocstoreClient.updateDoc @project_id, @doc_id, @largeLines, @newVersion, (error, res, @body) =>
done()
it "should return modified = true", ->
@body.modified.should.equal true
it "should update the doc in the API", (done) ->
DocstoreClient.getDoc @project_id, @doc_id, (error, res, doc) =>
doc.lines.should.deep.equal @largeLines
doc.version.should.deep.equal @newVersion
done()