From 18c479f0b09bb406c21c707bf7acc03fc34ef0a0 Mon Sep 17 00:00:00 2001 From: Bartek Grzybowski Date: Thu, 16 Apr 2020 01:35:48 -0700 Subject: Return http 404 for wrong prefix, not 401 The correct http code for wrong REST API url should be http "404 Not Found", not "401 Unauthorized". Change-Id: I78710fcd4c43926dbba3227c4099bf6239095f19 Issue-ID: INT-1529 Signed-off-by: Bartek Grzybowski --- test/mocks/prov-mns-provider/src/ProvMnSProvider.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'test/mocks') diff --git a/test/mocks/prov-mns-provider/src/ProvMnSProvider.py b/test/mocks/prov-mns-provider/src/ProvMnSProvider.py index e9d488ede..da445e223 100644 --- a/test/mocks/prov-mns-provider/src/ProvMnSProvider.py +++ b/test/mocks/prov-mns-provider/src/ProvMnSProvider.py @@ -83,10 +83,11 @@ class ServerHTTP(BaseHTTPRequestHandler): print("Fail to get MOI object: "+'/' +className+'/'+idName) self.send_response(406) else: - self.send_response(401) if prefix_check is True: + self.send_response(401) response['error'] = {"errorInfo":"not Authorized"} else: + self.send_response(404) response['error'] = {"errorInfo":"wrong prefix"} self.send_header("Content-type","application/json") self.end_headers() @@ -151,10 +152,11 @@ class ServerHTTP(BaseHTTPRequestHandler): print("Fail to modify MOI object: "+'/' +className+'/'+idName) self.send_response(406) else: - self.send_response(401) if prefix_check is True: + self.send_response(401) response['error'] = {"errorInfo":"not Authorized"} else: + self.send_response(404) response['error'] = {"errorInfo":"wrong prefix"} self.send_header("Content-type","application/json") self.end_headers() @@ -203,10 +205,11 @@ class ServerHTTP(BaseHTTPRequestHandler): print("Fail to delete MOI object: "+'/' +className+'/'+idName) self.send_response(406) else: - self.send_response(401) if prefix_check is True: + self.send_response(401) response['error'] = {"errorInfo":"not Authorized"} else: + self.send_response(404) response['error'] = {"errorInfo":"wrong prefix"} self.send_header("Content-type","application/json") self.end_headers() @@ -252,10 +255,11 @@ class ServerHTTP(BaseHTTPRequestHandler): print("Fail to create MOI object: "+'/' +className+'/'+idName) self.send_response(406) else: - self.send_response(401) if prefix_check is True: + self.send_response(401) response['error'] = {"errorInfo":"not Authorized"} else: + self.send_response(404) response['error'] = {"errorInfo":"wrong prefix"} self.send_header("Content-type","application/json") self.end_headers() -- cgit 1.2.3-korg