Given the variable responder is creating the responder you should probably make this a function. Then given that logic you might as well build the router inside that function as well. I think these changes make it clearer what needs to be done. Also the test lambdas just look cleaner.
I also think we shouldn't ask the user to generate the HBApplicationContext. Some of its members should be coming from the LambdaContext and the thread pool should be set up by us.
Thoughts?
One other thing. I didn't change but I don't think it is necessary to have a generic Encoder and Decoder. They get used as existentials internally in HB.
Given the variable
responder
is creating the responder you should probably make this a function. Then given that logic you might as well build the router inside that function as well. I think these changes make it clearer what needs to be done. Also the test lambdas just look cleaner.I also think we shouldn't ask the user to generate the HBApplicationContext. Some of its members should be coming from the LambdaContext and the thread pool should be set up by us.
Thoughts?
One other thing. I didn't change but I don't think it is necessary to have a generic Encoder and Decoder. They get used as existentials internally in HB.