使用哪种表示方式取决于request,
Accept标头
mime类型。
的请求
application/octet-stream将通过使用你的
binary函数来响应。
如果你需要API方法中的特定响应类型,则必须使用
flask.make_response()返回“预烘焙”响应对象:
def get(self): response = flask.make_response(something) response.headers['content-type'] = 'application/octet-stream' return response



