Allow setting code and headers
Add some failing tests