Where a person has been committed to custody for failing to enter into bond, the person is entitled to the writ of habeas corpus, if it be stated in the application that there was no sufficient cause for requiring bail or that the bail required is excessive. If the proof sustains the application, it will entitle the person to be discharged or have the bail reduced.