当响应http类型为 的文件的请求jsonl时,即由换行符分隔的 json 对象的集合,我应该设置什么 mime 类型?我尝试在 SO 上搜索jsonl mime typeand jsonl mimetype,但找不到任何有关它的信息。
我的回复如下(flask/python):
response = Response(
generate_jsonl(object_iterable),
mimetype='application/json',
headers={
'Content-Type': 'application/json;charset=UTF-8',
'Content-Disposition': 'attachment;filename=%s.json' % file_name,
},
)
Run Code Online (Sandbox Code Playgroud)
一些网站使用application/json-lines.
一些application/jsonl。
还有一些更具异国情调,例如application/x-...。
这似乎是一个任你选择的领域......