Commits

Jeremy Sandell committed 90ee94d Draft

more work on requests

  • Participants
  • Parent commits a437ad5

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");
+}