use middleware to set json request headers and extension