It tests the legality of a detention or a restraint and the goal is to use it really almost i guess it's an emergency basis. The writ of habeas corpus primarily acts as a writ of inquiry, issued to test the reasons or grounds for restraint and detention.A writ of habeas corpus requires that a person who is in custody be brought before a judge or court and that they be able to challenge that custody. Remember that a writ of habeas corpus is a lawsuit against the warden who is confining the defendant. The Habeas Corpus petition claims the arrest, sentence, or trial violated constitutional law, making imprisonment unlawful. The writ of habeas corpus is a legal order requiring a person holding another person to produce that individual before a court or judge. Habeas corpus means "that you have the body," and is a writ of inquiry used to test the validity of a person's detention. 701 Clematis Street. In many countries, authorities may incarcerate someone for months or years without charging them.