Skip to content

Commit

Permalink
try with gzip
Browse files Browse the repository at this point in the history
  • Loading branch information
BernhardKoschicek committed Sep 25, 2023
1 parent 7a85b4b commit 35b86ef
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion openatlas/views/file.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import gzip
import json
import os
import subprocess
from pathlib import Path
Expand Down Expand Up @@ -165,7 +167,11 @@ def getManifest(id_):
@app.route('/iiif_manifest/<int:id_>.json')
@cross_origin()
def iiif_manifest(id_: int):
return jsonify(getManifest(id_))
content = gzip.compress(json.dumps(getManifest(id_)).encode('utf8'), 5)
response = jsonify(content)
response.headers['Content-length'] = len(content)
response.headers['Content-Encoding'] = 'gzip'
return response


@app.route('/iiif/<int:id_>', methods=['GET'])
Expand Down

0 comments on commit 35b86ef

Please sign in to comment.