Jeremy Sandell avatar Jeremy Sandell committed 90ee94d Draft

more work on requests

Comments (0)

Files changed (1)

 module request;
 
-import std.socket;
-import std.typecons : Tuple, tuple;
-import std.string: format;
-import std.base64 : Base64;
+private {
+    import std.socket : InternetAddress, TcpSocket, Socket;
+    import std.typecons : Tuple, tuple;
+    import std.string: format;
+    import util.encoding;
+}
 
+debug=info;
+
+debug(info)
+{
+    private import std.stdio : writefln;
+}
+
+
+enum request_method 
+{
+    GET,
+    POST,
+    PUT,
+    OPTIONS,
+    DELETE
+}
+
+class Session {
+    alias Tuple!(string, "name", string, "value") Header;
+    Header[] headers;
+
+    alias Tuple!(string, "username", string, "password") Auth;
+    Auth auth;
+
+    this()
+    {
+    }
+
+    Response request(request_method method, string url,
+                     params  = null,
+                     data    = null,
+                     headers = null,
+                     cookies = null,
+                     auth    = null,
+                     timeout = null)
+            {
+                return Response();
+            }
+             
+
+}
+
+class Response {
+}
 
 class Request {
-    
-    alias Tuple!(string, "name", string, "value") header;
-
-    header[] headers;
-
     Socket sock;
 
     this()
 
     }
 }
+
+
+unittest
+{
+    auto r = new Request;
+    auto s = new Session;
+
+    debug(info) writefln("foo");
+}
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.