Commit e891b2da authored by 9731301's avatar 9731301

add some changes

parent fb2d11ec
...@@ -7,25 +7,9 @@ ...@@ -7,25 +7,9 @@
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="f2dd20fb-7e97-49ef-9dfe-5631626d7912" name="Default Changelist" comment=""> <list default="true" id="f2dd20fb-7e97-49ef-9dfe-5631626d7912" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/Requests/test2.insomnia" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" /> <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$1.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$1.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/Insomnia.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/Insomnia.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$10.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$10.class" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/Parser.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/Parser.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$11.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$11.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$12.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$12.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$13.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$13.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$2.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$2.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$3.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$3.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$4.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$4.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$5.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$5.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$6.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$6.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$7.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$7.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$8.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$8.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$9.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel$9.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/GUI/RequestPanel.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/parser/RequestData.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/parser/RequestData.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/parser/RequestLoader.class" beforeDir="false" afterPath="$PROJECT_DIR$/out/production/Insomnia/com/insomnia/parser/RequestLoader.class" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/insomnia/GUI/RequestPanel.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/GUI/RequestPanel.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/RequestData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/RequestData.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/RequestData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/RequestData.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/RequestLoader.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/RequestLoader.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/RequestLoader.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/RequestLoader.java" afterDir="false" />
<change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/ResponseData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/ResponseData.java" afterDir="false" /> <change beforePath="$PROJECT_DIR$/src/com/insomnia/parser/ResponseData.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/com/insomnia/parser/ResponseData.java" afterDir="false" />
...@@ -166,7 +150,10 @@ ...@@ -166,7 +150,10 @@
<workItem from="1591024948574" duration="21598000" /> <workItem from="1591024948574" duration="21598000" />
<workItem from="1591127468443" duration="7941000" /> <workItem from="1591127468443" duration="7941000" />
<workItem from="1591179932347" duration="2513000" /> <workItem from="1591179932347" duration="2513000" />
<workItem from="1591205535989" duration="7908000" /> <workItem from="1591205535989" duration="8740000" />
<workItem from="1591376356200" duration="7395000" />
<workItem from="1591474740815" duration="314000" />
<workItem from="1591548369519" duration="737000" />
</task> </task>
<servers /> <servers />
</component> </component>
...@@ -201,30 +188,30 @@ ...@@ -201,30 +188,30 @@
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="402" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1590494460700" /> <state x="402" y="167" key="FileChooserDialogImpl/0.0.1536.824@0.0.1536.824" timestamp="1590494460700" />
<state width="1493" height="154" key="GridCell.Tab.0.bottom" timestamp="1591213140323"> <state width="1493" height="154" key="GridCell.Tab.0.bottom" timestamp="1591216845298">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="154" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1591213140323" /> <state width="1493" height="154" key="GridCell.Tab.0.bottom/0.0.1536.824@0.0.1536.824" timestamp="1591216845298" />
<state width="1493" height="154" key="GridCell.Tab.0.center" timestamp="1591213140322"> <state width="1493" height="154" key="GridCell.Tab.0.center" timestamp="1591216845298">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="154" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1591213140322" /> <state width="1493" height="154" key="GridCell.Tab.0.center/0.0.1536.824@0.0.1536.824" timestamp="1591216845298" />
<state width="1493" height="154" key="GridCell.Tab.0.left" timestamp="1591213140322"> <state width="1493" height="154" key="GridCell.Tab.0.left" timestamp="1591216845298">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="154" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1591213140322" /> <state width="1493" height="154" key="GridCell.Tab.0.left/0.0.1536.824@0.0.1536.824" timestamp="1591216845298" />
<state width="1493" height="154" key="GridCell.Tab.0.right" timestamp="1591213140323"> <state width="1493" height="154" key="GridCell.Tab.0.right" timestamp="1591216845298">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state width="1493" height="154" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1591213140323" /> <state width="1493" height="154" key="GridCell.Tab.0.right/0.0.1536.824@0.0.1536.824" timestamp="1591216845298" />
<state x="249" y="0" key="SettingsEditor" timestamp="1590962002174"> <state x="249" y="0" key="SettingsEditor" timestamp="1590962002174">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="249" y="0" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1590962002174" /> <state x="249" y="0" key="SettingsEditor/0.0.1536.824@0.0.1536.824" timestamp="1590962002174" />
<state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1591205543692"> <state x="425" y="237" key="com.intellij.ide.util.TipDialog" timestamp="1591548525191">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
<state x="425" y="237" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1591205543692" /> <state x="425" y="237" key="com.intellij.ide.util.TipDialog/0.0.1536.824@0.0.1536.824" timestamp="1591548525191" />
<state x="499" y="179" key="extract.method.dialog" timestamp="1590145349556"> <state x="499" y="179" key="extract.method.dialog" timestamp="1590145349556">
<screen x="0" y="0" width="1536" height="824" /> <screen x="0" y="0" width="1536" height="824" />
</state> </state>
......
...@@ -3,6 +3,16 @@ package com.insomnia.parser; ...@@ -3,6 +3,16 @@ package com.insomnia.parser;
public class Insomnia { public class Insomnia {
public static void main(String [] args) { public static void main(String [] args) {
for (String arg : args){
if (arg.replace("-","").trim().toLowerCase().equals("help")){
System.out.println("Insomnia Commands : ");
System.out.println("-url : enter url");
System.out.println("--Method : set request method (GET,POST,PUT,DELETE)");
return;
}
}
ResponseData data = RequestLoader.run(Parser.parse(args)); ResponseData data = RequestLoader.run(Parser.parse(args));
if (data.hasSyntaxError()){ if (data.hasSyntaxError()){
......
...@@ -108,7 +108,7 @@ public class Parser { ...@@ -108,7 +108,7 @@ public class Parser {
return v.toUpperCase().trim(); return v.toUpperCase().trim();
default: default:
return RequestData.GET; return "GET";
} }
} }
......
...@@ -10,10 +10,9 @@ import java.util.HashMap; ...@@ -10,10 +10,9 @@ import java.util.HashMap;
public class RequestData implements Serializable { public class RequestData implements Serializable {
private String name = ""; private String name = "";
//methods requests
public static String GET = "GET", POST = "POST", DELETE="DELETE", PUT="PUT";
//address of request //address of request
private String url = "",method = GET; private String url = "",method = "GET";
private boolean followRedirects = false; private boolean followRedirects = false;
private HashMap<String,String> headers = null; private HashMap<String,String> headers = null;
......
...@@ -35,7 +35,7 @@ public class RequestLoader { ...@@ -35,7 +35,7 @@ public class RequestLoader {
try { try {
String mUrl = data.getUrl(); String mUrl = data.getUrl();
if (data.getMethod().equals(RequestData.GET)) { if (data.getMethod().equals("GET")) {
if (mUrl.contains("?")) { if (mUrl.contains("?")) {
mUrl = mUrl + "&" + data.getBody(); mUrl = mUrl + "&" + data.getBody();
}else{ }else{
...@@ -47,12 +47,12 @@ public class RequestLoader { ...@@ -47,12 +47,12 @@ public class RequestLoader {
HttpURLConnection con = (HttpURLConnection) url.openConnection(); HttpURLConnection con = (HttpURLConnection) url.openConnection();
con.setUseCaches(false); con.setUseCaches(false);
if (!data.getMethod().equals(RequestData.GET) && (!data.getBody().isEmpty()||!data.getUploadPath().isEmpty()) ){ if (!data.getMethod().equals("GET") && (!data.getBody().isEmpty()||!data.getUploadPath().isEmpty()) ){
con.setDoOutput(true); con.setDoOutput(true);
} }
con.setDoInput(true); con.setDoInput(true);
con.setInstanceFollowRedirects(data.isFollowRedirects()); con.setInstanceFollowRedirects(data.isFollowRedirects());//change direction
con.setRequestMethod(data.getMethod()); con.setRequestMethod(data.getMethod());
String content_type = ""; String content_type = "";
......
/** /**
* ResponseData represents a class * ResponseData represents a class that contains responses data and has some methods to keep these information
*/ */
package com.insomnia.parser; package com.insomnia.parser;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment