Update API controller to use request headers if present