Skip to content
This repository has been archived by the owner on Mar 20, 2021. It is now read-only.
/ plutonium-http Public archive

Making it possible to do basic http GET, POST, PUT & DELETE requests within ChaiScript.

License

Notifications You must be signed in to change notification settings

ryanocf/plutonium-http

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Making it possible to do basic http GET, POST, PUT & DELETE requests within ChaiScript.

Resources

License

Stars

Watchers

Forks

Languages