From 6cf86be0335cb49cce3fdf59341a0ac80837fcb2 Mon Sep 17 00:00:00 2001 From: kansi Date: Fri, 16 Feb 2018 18:42:06 +0530 Subject: [PATCH] Remove location header from post txn response --- bigchaindb/web/views/transactions.py | 9 --------- docs/server/generate_http_server_api_documentation.py | 1 - docs/server/source/http-client-server-api.rst | 10 +++------- 3 files changed, 3 insertions(+), 17 deletions(-) diff --git a/bigchaindb/web/views/transactions.py b/bigchaindb/web/views/transactions.py index ae753208..783d020a 100644 --- a/bigchaindb/web/views/transactions.py +++ b/bigchaindb/web/views/transactions.py @@ -95,13 +95,4 @@ class TransactionListApi(Resource): response = jsonify(tx) response.status_code = 202 - # NOTE: According to W3C, sending a relative URI is not allowed in the - # Location Header: - # - https://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html - # - # Flask is autocorrecting relative URIs. With the following command, - # we're able to prevent this. - response.autocorrect_location_header = False - status_monitor = '../statuses?transaction_id={}'.format(tx_obj.id) - response.headers['Location'] = status_monitor return response diff --git a/docs/server/generate_http_server_api_documentation.py b/docs/server/generate_http_server_api_documentation.py index 7e683bb6..bc12f913 100644 --- a/docs/server/generate_http_server_api_documentation.py +++ b/docs/server/generate_http_server_api_documentation.py @@ -69,7 +69,6 @@ Content-Type: application/json TPLS['post-tx-response'] = """\ HTTP/1.1 202 Accepted -Location: ../statuses?transaction_id=%(txid)s Content-Type: application/json %(tx)s diff --git a/docs/server/source/http-client-server-api.rst b/docs/server/source/http-client-server-api.rst index 68ad5d7c..1e8d03e1 100644 --- a/docs/server/source/http-client-server-api.rst +++ b/docs/server/source/http-client-server-api.rst @@ -159,15 +159,11 @@ Transactions :language: http .. note:: - If the server is returning a ``202`` HTTP status code, then the - transaction has been accepted for processing. To check the status of the - transaction, poll the link to the - :ref:`status monitor ` - provided in the ``Location`` header or listen to server's - :ref:`WebSocket Event Stream API `. + If the server is returning a ``202`` HTTP status code when ``mode=aysnc`` or ``mode=sync``, then the + transaction has been accepted for processing. The client can subscribe to + :ref:`WebSocket Event Stream API ` for listen for comitted transactions. :resheader Content-Type: ``application/json`` - :resheader Location: Relative link to a status monitor for the submitted transaction. :statuscode 202: The pushed transaction was accepted in the ``BACKLOG``, but the processing has not been completed. :statuscode 400: The transaction was malformed and not accepted in the ``BACKLOG``.