Refactor http header
Use type switch for error types (stupid mistake)