From ad29f38cbcb164a7f328b26daf789dbff90deb98 Mon Sep 17 00:00:00 2001 From: Ankitkumar Patel Date: Wed, 28 Mar 2018 14:27:53 -0400 Subject: Update the SO sync and async responses. Updated the sync and async responses and addes testcases related to policy adaptors. Issue-ID: OPTFRA-208 Change-Id: Ia0f88df1b897b6158674f3c3a7ef239f2328dcfc Signed-off-by: Ankitkumar Patel --- osdf/operation/responses.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'osdf/operation') diff --git a/osdf/operation/responses.py b/osdf/operation/responses.py index 22a94f7..84bb2cc 100644 --- a/osdf/operation/responses.py +++ b/osdf/operation/responses.py @@ -21,15 +21,19 @@ from flask import Response from osdf import ACCEPTED_MESSAGE_TEMPLATE -def osdf_response_for_request_accept(req_id="", text="", response_code=202, as_http=True): +def osdf_response_for_request_accept(request_id="", transaction_id="", request_status="", status_message="", + response_code=202, as_http=True): """Helper method to create a response object for request acceptance, so that the object can be sent to a client - :param req_id: request ID provided by the caller - :param text: extra text description about accepting the request (e.g. "Request accepted") + :param request_id: request ID provided by the caller + :param transaction_id: transaction ID provided by the caller + :param request_status: the status of a request + :param status_message: details on the status of a request :param response_code: the HTTP status code to send -- default is 202 (accepted) :param as_http: whether to send response as HTTP response object or as a string :return: if as_http is True, return a HTTP Response object. Otherwise, return json-encoded-message """ - response_message = ACCEPTED_MESSAGE_TEMPLATE.render(description=text, request_id=req_id) + response_message = ACCEPTED_MESSAGE_TEMPLATE.render(request_id=request_id, transaction_id=transaction_id, + request_status=request_status, status_message=status_message) if not as_http: return response_message -- cgit 1.2.3-korg