mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-16 02:02:13 -05:00
15 lines
365 B
Python
15 lines
365 B
Python
from flask import request
|
|
from werkzeug.exceptions import BadRequest
|
|
|
|
from app.v2.errors import BadRequestError
|
|
|
|
|
|
def get_valid_json():
|
|
try:
|
|
request_json = request.get_json(force=True)
|
|
except BadRequest:
|
|
raise BadRequestError(
|
|
message="Invalid JSON supplied in POST data", status_code=400
|
|
)
|
|
return request_json or {}
|