Write Status first then hijack the response writer. This allows the access log to correctly record response status. Also removed some of the redundant error checking.
2. Please link to the relevant issues.
3. Which documentation changes (if any) need to be made because of this PR?
4. Checklist
[ ] I have written tests and verified that they fail without my change
[X] I made pull request as minimal and simple as possible. If change is not small or additional dependencies are required, I opened an issue to propose and discuss the design first
[ ] I have squashed any insignificant commits
[ ] This change has comments for package types, values, functions, and non-obvious lines of code
1. What does this change do, exactly?
Write Status first then hijack the response writer. This allows the access log to correctly record response status. Also removed some of the redundant error checking.
2. Please link to the relevant issues.
3. Which documentation changes (if any) need to be made because of this PR?
4. Checklist