mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-14 22:23:42 +01:00
Merge pull request #1354 from sharelatex/ew-async-zip-download
use async project history zip download api GitOrigin-RevId: 847e22eb3bf89e2e9e3c86bcc9ae92f8c90b25b1
This commit is contained in:
committed by
sharelatex
parent
a521a86fb7
commit
c303af5d4d
@@ -5,12 +5,22 @@ app = express()
|
||||
{ObjectId} = require 'mongojs'
|
||||
|
||||
module.exports = MockV1HistoryApi =
|
||||
fakeZipCall: 0
|
||||
run: () ->
|
||||
app.get "/api/projects/:project_id/version/:version/zip", (req, res, next) =>
|
||||
res.header('content-disposition', 'attachment; name=project.zip')
|
||||
res.header('content-type', 'application/octet-stream')
|
||||
res.send "Mock zip for #{req.params.project_id} at version #{req.params.version}"
|
||||
|
||||
app.get "/fake-zip-download/:project_id/version/:version", (req, res, next) =>
|
||||
return res.sendStatus 404 unless @fakeZipCall++ > 0
|
||||
res.header('content-disposition', 'attachment; name=project.zip')
|
||||
res.header('content-type', 'application/octet-stream')
|
||||
res.send "Mock zip for #{req.params.project_id} at version #{req.params.version}"
|
||||
|
||||
app.post "/api/projects/:project_id/version/:version/zip", (req, res, next) =>
|
||||
res.json zipUrl: "http://localhost:3100/fake-zip-download/#{req.params.project_id}/version/#{req.params.version}"
|
||||
|
||||
app.listen 3100, (error) ->
|
||||
throw error if error?
|
||||
.on "error", (error) ->
|
||||
|
||||
Reference in New Issue
Block a user