|
@@ -1,7 +1,5 @@
|
|
|
import simplejson as json
|
|
|
from django.shortcuts import HttpResponse
|
|
|
-import gzip
|
|
|
-from io import BytesIO
|
|
|
|
|
|
|
|
|
class ResponseObject(object):
|
|
@@ -308,14 +306,4 @@ class ResponseObject(object):
|
|
|
if res is None:
|
|
|
res = {}
|
|
|
result = self.formal(code, res)
|
|
|
- # 将数据压缩
|
|
|
- buffer = BytesIO()
|
|
|
- with gzip.GzipFile(fileobj=buffer, mode='wb') as f:
|
|
|
- f.write(result.encode('utf-8'))
|
|
|
-
|
|
|
- compressed_content = buffer.getvalue()
|
|
|
-
|
|
|
- response = HttpResponse(compressed_content, content_type='application/json')
|
|
|
- response['Content-Encoding'] = 'gzip'
|
|
|
- response['Content-Length'] = str(len(compressed_content))
|
|
|
- return response
|
|
|
+ return HttpResponse(result)
|