remove multi-dispatch code, not that useful to us
This commit is contained in:
parent
c5a3a002b6
commit
4fa7f1ff56
1 changed files with 6 additions and 21 deletions
|
@ -45,36 +45,21 @@ func _ready() -> void:
|
|||
|
||||
func _test_http() -> void:
|
||||
print(yield(request_execute("Gateway.getDatetime"), "completed"))
|
||||
print(yield(request_execute(["Gateway.getDatetime", "Gateway.getVersion"], {}, "", ["blep", "bleepo"]), "completed"))
|
||||
|
||||
|
||||
## requests the provided component be executed, do not call async :/
|
||||
# may call with either single or multiple components
|
||||
func request_execute(component, parameters = {}, session_id: String = "", echo = null, encrypt: bool = false) -> Dictionary:
|
||||
func request_execute(component: String, parameters: Dictionary = {}, session_id: String = "", echo: String = "", encrypt: bool = false) -> Dictionary:
|
||||
# build request headers
|
||||
var headers = [
|
||||
"Content-Type: application/x-www-form-urlencoded",
|
||||
]
|
||||
# build execute object
|
||||
var execute
|
||||
if component is Array:
|
||||
execute = []
|
||||
for i in component.size():
|
||||
if component[i] is String:
|
||||
execute.append({
|
||||
component = component[i],
|
||||
})
|
||||
if parameters is Array and parameters[i] is Dictionary:
|
||||
execute[-1].parameters = parameters[i]
|
||||
if echo is Array and echo[i] is String:
|
||||
execute[-1].echo = echo[i]
|
||||
else:
|
||||
execute = {
|
||||
component = component,
|
||||
parameters = parameters,
|
||||
}
|
||||
if echo is String:
|
||||
execute.echo = echo
|
||||
var execute = {
|
||||
component = component,
|
||||
parameters = parameters,
|
||||
echo = echo,
|
||||
}
|
||||
# use encryption if a valid key is available
|
||||
# TODO: implementation messed up in some way. encryption is fine, but
|
||||
# formatting is wrong in some way that newgrounds can not understand
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue