Visit this project on Github: https://github.com/ryanocf/plutonium-http
plutonium-http
Making it possible to do basic http GET, POST, PUT & DELETE requests within ChaiScript.
This plugin was mainly built for Plutonium MW3.
Download
Download the latest release and put the plutonium-http.dll in your servers plugin folder.
Usage
OpenSSL is currently not supported.
Every function returns the same Vector scheme:
0: version // String
1: error // String
2: status // Int
3: reason // String
4: body // String
5: headers // Map
/*
* Params
* url: String
* route: String
* headers: Map
*
* return: Vector
*/
http_get("http://example.com", "/route", ["header": "value"]);
/*
* Params
* url: String
* route: String
* body: String
* headers: Map
* content_type: String
*
* return: Vector
*/
http_post("http://example.com", "/route", "body", ["header": "value"], "text/plain");
http_post("http://example.com", "/route", "param=body&format=string", ["header": "value"], "application/x-www-form-urlencoded");
/*
* Params
* url: String
* route: String
* body: String
* headers: Map
* content_type: String
*
* return: Vector
*/
http_put("http://example.com", "/route", "body", ["header": "value"], "text/plain");
http_put("http://example.com", "/route", "param=body&format=string", ["header": "value"], "application/x-www-form-urlencoded");
/*
* Params
* url: String
* route: String
* body: String
* headers: Map
* content_type: String
*
* return: Vector
*/
http_delete("http://example.com", "/route", "body", ["header": "value"], "text/plain");
http_delete("http://example.com", "/route", "param=body&format=string", ["header": "value"], "application/x-www-form-urlencoded");
Errors
std::array<std::string, 13> error_list = {
"Success",
"Unknown",
"Connection",
"BindIPAddress",
"Read",
"Write",
"ExceedRedirectCount",
"Canceled",
"SSLConnection",
"SSLLoadingCerts",
"SSLServerVerification",
"UnsupportedMultipartBoundaryChars",
"Compression"
};
Any questions or problems?
Feel free to open an issue or visit this project on Plutonium.
Credits
https://github.com/yhirose/cpp-httplib
https://github.com/ChaiScript/ChaiScript
https://github.com/xensik/plutoscript