REST API endpoint for the default branch returns a 404 for empty repositories when just created by Bitbucket:
When using the REST point:
- for empty repos: return the equivalent of the "Not defined" value shown in the webpage (see attached screenshot).
- for the repos with an invalid default, 404 is legitimate (current behavior)
Use a try/catch block and post-process the list of 404 repos with /branches to separate the really empty from the misconfigured.