testingwebapp fixes, weeek tasks 2948-2958
This commit is contained in:
@@ -11,6 +11,7 @@ import secrets
|
||||
from datetime import timedelta
|
||||
|
||||
from flask import Flask, jsonify, render_template, request
|
||||
from werkzeug.exceptions import RequestEntityTooLarge
|
||||
|
||||
|
||||
_ROLE_LABELS = {
|
||||
@@ -89,6 +90,12 @@ def create_app() -> Flask:
|
||||
'format_role': _format_role,
|
||||
}
|
||||
|
||||
@app.errorhandler(RequestEntityTooLarge)
|
||||
def _payload_too_large(_e):
|
||||
if _is_api_path():
|
||||
return jsonify(error='Файл слишком большой (лимит загрузки на сервере).'), 413
|
||||
return ('Файл слишком большой.', 413, {'Content-Type': 'text/plain; charset=utf-8'})
|
||||
|
||||
@app.errorhandler(404)
|
||||
def _not_found(_e):
|
||||
if _is_api_path():
|
||||
|
||||
Reference in New Issue
Block a user