add status code middleware