diff options
author | hongyuzhao <zhao.hongyu@zte.com.cn> | 2019-06-14 16:15:04 +0800 |
---|---|---|
committer | Fu Jinhua <fu.jinhua@zte.com.cn> | 2019-06-14 08:48:57 +0000 |
commit | 6a15a10abf1ea0d90708c607a1bfc00dc50ca06f (patch) | |
tree | 2a767da2116a20a4c8861f1f1e9e42518fefb129 /lcm/lcm/nf/views/subscriptions_view.py | |
parent | db895fab77265d947dedb657d77941020278400c (diff) |
Fix bug for status code when subscription post request body invalid what client inputs.
Issue-ID: VFC-1417
Signed-off-by: hongyuzhao <zhao.hongyu@zte.com.cn>
Change-Id: Id18312e77a6d93ac1afd8c5b8307f44f51a744cd
Diffstat (limited to 'lcm/lcm/nf/views/subscriptions_view.py')
-rw-r--r-- | lcm/lcm/nf/views/subscriptions_view.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lcm/lcm/nf/views/subscriptions_view.py b/lcm/lcm/nf/views/subscriptions_view.py index a9ffed9b..c5496277 100644 --- a/lcm/lcm/nf/views/subscriptions_view.py +++ b/lcm/lcm/nf/views/subscriptions_view.py @@ -27,7 +27,7 @@ from lcm.nf.serializers.lccn_subscription_request import LccnSubscriptionRequest from lcm.nf.serializers.lccn_subscription import LccnSubscriptionSerializer
from lcm.nf.serializers.lccn_subscriptions import LccnSubscriptionsSerializer
from lcm.nf.serializers.response import ProblemDetailsSerializer
-from lcm.pub.exceptions import NFLCMException
+from lcm.pub.exceptions import NFLCMException, NFLCMExceptionBadRequest
from .common import view_safe_call_with_log
logger = logging.getLogger(__name__)
@@ -50,6 +50,7 @@ class SubscriptionsView(APIView): responses={
status.HTTP_201_CREATED: LccnSubscriptionSerializer(),
status.HTTP_303_SEE_OTHER: ProblemDetailsSerializer(),
+ status.HTTP_400_BAD_REQUEST: ProblemDetailsSerializer(),
status.HTTP_500_INTERNAL_SERVER_ERROR: ProblemDetailsSerializer()
}
)
@@ -59,7 +60,7 @@ class SubscriptionsView(APIView): lccn_subscription_request_serializer = LccnSubscriptionRequestSerializer(data=request.data)
if not lccn_subscription_request_serializer.is_valid():
- raise NFLCMException(lccn_subscription_request_serializer.errors)
+ raise NFLCMExceptionBadRequest(lccn_subscription_request_serializer.errors)
subscription = CreateSubscription(
lccn_subscription_request_serializer.data).do_biz()
lccn_notifications_filter = {
|