Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added AngelScript HTTP request API #107

Closed
wants to merge 3 commits into from

Conversation

ohlidalp
Copy link
Member

@ohlidalp ohlidalp commented Oct 5, 2020

Excerpt from new file "contrib/example-script.as":

void main() {
    server.Log("Hello angelscript!");
    
    HttpResponse response = server.httpRequest(
        "GET",                    // Method: GET/POST/PUT/DELETE
        "www.example.com",        // Host
        "/",                      // Server file path
        "text/plain",             // Content type, see https://en.wikipedia.org/wiki/Media_type
        "");                      // Payload
    string logHttp = "HTTP response code: " + response.getCode(); // For text, use `response.getBody()`
    server.Log(logHttp);
}

Outputs:

05-10-2020 14:35:51|t01| INFO|SCRIPT|Hello angelscript!
05-10-2020 14:35:52|t01| INFO|SCRIPT|HTTP response code: 200

Renamed ScriptEngine to script-engine, for consistency.
Extracted 'server-script' from 'script-engine', moved class ServerScript
added function `static void ServerScript::Register()`, code extracted from `ScriptEngine::Init()`
See file 'contrib/example-script.as'
@ohlidalp
Copy link
Member Author

ohlidalp commented Jan 7, 2025

Closing - superseded by #160

@ohlidalp ohlidalp closed this Jan 7, 2025
@ohlidalp ohlidalp deleted the httpscript branch January 26, 2025 16:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant