Skip to content

Commit

Permalink
Fix response interceptor keyword argument (#92)
Browse files Browse the repository at this point in the history
Fixes #91.
  • Loading branch information
nikhilym committed May 30, 2019
1 parent 928027f commit 48c8323
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ask-sdk-runtime/ask_sdk_runtime/dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def dispatch(self, handler_input):

for response_interceptor in self.response_interceptors:
response_interceptor.process(
handler_input=handler_input, dispatch_output=output)
handler_input=handler_input, response=output)

return output
except Exception as e:
Expand Down Expand Up @@ -186,6 +186,6 @@ def __dispatch_request(self, handler_input):
request_handler_chain.response_interceptors)
for response_interceptor in local_response_interceptors:
response_interceptor.process(
handler_input=handler_input, dispatch_output=output)
handler_input=handler_input, response=output)

return output
Original file line number Diff line number Diff line change
Expand Up @@ -97,16 +97,16 @@ class AbstractResponseInterceptor(object):
__metaclass__ = ABCMeta

@abstractmethod
def process(self, handler_input, dispatch_output):
def process(self, handler_input, response):
# type: (Input, Output) -> None
"""Process the input and the output after the Handler is run.
:param handler_input: Generic input passed to the
dispatcher.
:type handler_input: Input
:param dispatch_output: Execution result of the Handler on
:param response: Execution result of the Handler on
dispatch input.
:type dispatch_output: Union[None, Output]
:type response: Union[None, Output]
:rtype: None
"""
raise NotImplementedError
Expand Down
8 changes: 4 additions & 4 deletions ask-sdk-runtime/tests/unit/test_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@ def test_handler_input_successful_local_response_interceptors_execution(self):

test_interceptor_1.process.assert_called_once_with(
handler_input=self.valid_handler_input,
dispatch_output=test_response_before_interceptor), (
response=test_response_before_interceptor), (
"Dispatcher dispatch method didn't process local response "
"interceptors after calling request handler "
"handle")

test_interceptor_2.process.assert_called_once_with(
handler_input=self.valid_handler_input,
dispatch_output=test_response_from_interceptor_1), (
response=test_response_from_interceptor_1), (
"Dispatcher dispatch method didn't process local response "
"interceptors after calling request handler "
"handle")
Expand Down Expand Up @@ -350,13 +350,13 @@ def test_handler_input_successful_global_response_interceptors_execution(self):

test_interceptor_1.process.assert_called_once_with(
handler_input=self.valid_handler_input,
dispatch_output=test_response_before_interceptor), (
response=test_response_before_interceptor), (
"Dispatcher dispatch method didn't process global request "
"interceptors after calling dispatch request")

test_interceptor_2.process.assert_called_once_with(
handler_input=self.valid_handler_input,
dispatch_output=test_response_from_interceptor_1), (
response=test_response_from_interceptor_1), (
"Dispatcher dispatch method didn't process global request "
"interceptors after calling dispatch request")

Expand Down

0 comments on commit 48c8323

Please sign in to comment.