Decouple middleware data from api struct
Green tests