first pass at docs update
@@ -49,9 +49,56 @@ HTTP.post("https://httpbin.org/post", {"test": 10}, ["Content-Type: application/
HTTP.post("https://httpbin.org/post", {"test": 10}, ["Content-Type: application/json"], 1);
```
+### HTTP.newClient(dict)
+
+Creates a new HTTP client with a given set of options.
+Returns a Result and neecds to be unwraped upon success.
+
+```cs
+const opts = {
+ "timeout": 20,
+ "headers": [
+ "Content-Type: application/json",
+ "Accept: application/json",
+ "User-Agent: Dictu"
+ ],
+ "insecure": false,
+ "keyFile": "",
+ "certFile": "",
+ "keyPasswd": ""
+};
+const ret = HTTP.newClient(opts);
+if (not ret.success()) {
+ print(res.unwrapError());
+ System.exit(1);
+}
+var httpClient = ret.unwrap();
+```
+
+### httpClient.get(string)
+
+Sends a HTTP GET request to a given URL.
+Returns a Result and unwraps to a Response upon success.
+
+```cs
+httpClient.get("https://httpbin.org/get");
+
+{"content": "...", "headers": ["...", "..."], "statusCode": 200}
+```
+
+### HTTP.post(string, dictionary: postArgs)
+
+Sends a HTTP POST request to a given URL.
+Returns a Result and unwraps to a Response upon success.
+
+```cs
+httpClient.post("https://httpbin.org/post");
+httpClient.post("https://httpbin.org/post", {"test": 10});
+```
+
### Response
-Both HTTP.get() and HTTP.post() return a Result that unwraps a Response object on success, or nil on error.
+Both HTTP.get(), HTTP.post(), httpClient.get(), and httpClient.post() return a Result that unwraps a Response object on success, or nil on error.
The Response object returned has 3 public properties, "content", "headers" and "statusCode". "content" is the actual content returned from the
HTTP request as a string, "headers" is a list of all the response headers and "statusCode" is a number denoting the status code from
the response
@@ -60,7 +107,7 @@ the response
##### Properties
| Property | Description |
-|------------|--------------------------------------------------------|
+| ---------- | ------------------------------------------------- |
| content | Raw string content returned from the HTTP request |
| headers | A list of headers returned from the HTTP request |
| statusCode | The status code returned from the HTTP request |
@@ -68,7 +115,7 @@ the response
##### Methods
| Method | Description |
-|------------|--------------------------------------------------------|
+| ------ | ------------------------------------ |
| json | Convert the content property to JSON |
Example response from [httpbin.org](https://httpbin.org)
