package welcomemat.lockpick;

import org.apache.commons.io.IOUtils;
import org.jsoup.Jsoup;
import org.jsoup.helper.HttpConnection;
import org.jsoup.nodes.Document;

import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by nick on 4/5/14.
 */
public class Request {
    public static Response get(String URL, Map<String, String> headers) throws IOException {
        java.net.URL url = new URL(BASE_URL + path);
        HttpURLConnection http = (HttpURLConnection) url.openConnection();
        try {
            Map<String, String> headsWillRoll = generateHeaders(cookie);
            for(String field : headsWillRoll.keySet()) {
                http.setRequestProperty(field, headsWillRoll.get(field));
            }
            //gets first string using similar code to the for loop above
            Map<String, String> firsts = new HashMap<String, String>();
            for(String field : http.getHeaderFields().keySet()){
                firsts.put(field, http.getHeaderFields().get(field).get(0));
            }
            Response magical = new Response(IOUtils.toString(http.getInputStream()), firsts);
            return magical;
        } finally {
            http.disconnect();
        }
        return null;
    }
    public static Response post() {
        return null;
    }
}

@@ -391,19 +391,157 @@
 (String 
-URL
+path) throws IOException %7B%0A        return Request.get(path, new HashMap%3CString, String%3E());%0A    %7D%0A%0A    public static Response get(String path
 , Map%3CSt
@@ -730,81 +730,8 @@
 y %7B%0A
-            Map%3CString, String%3E headsWillRoll = generateHeaders(cookie);%0A
     
@@ -761,25 +761,19 @@
 d : head
-sWillRoll
+ers
 .keySet(
@@ -832,17 +832,11 @@
 head
-sWillRoll
+ers
 .get

Fix requests