Right now we're doing IntoCotResponse and IntoErrorResponse on each middleware that's being added to the project. While the overhead might not be terrible, it should be measured and if it turns out to be significant, it might be worth considering if changing the APIs is needed. One idea is to make sure that whatever gets passed into middleware() already has proper Response and Error types, and provide some conversion functionalities if not.
Right now we're doing
IntoCotResponseandIntoErrorResponseon each middleware that's being added to the project. While the overhead might not be terrible, it should be measured and if it turns out to be significant, it might be worth considering if changing the APIs is needed. One idea is to make sure that whatever gets passed intomiddleware()already has properResponseandErrortypes, and provide some conversion functionalities if not.