Add --debug flag to valac
Add content-type parameter
Improve error handling in authenticate method