I followed this question to try to send HTTP requests: https://groups.google.com/g/gama-platform/c/EMugXKTsEYY/m/BZ0ZqIQcAgAJ
The following code works, but when I change the contents of the send method to a map like in email chain, e.g.
["POST",["a"::1], ["Content-Type"::"application/json"] ];
I get an error saying a map cannot be converted to a string, pasted at the bottom.
model test
global {
init {
create radio number: 1;
}
}
species radio skills: [network]{
int msgSent;
init {
}
reflex fetch when: (msgSent = 0) {
do connect to: "http://localhost" protocol: "http" port: 10000 with_name: "server0" ;
do send to:"/wrangler/v1.0/fit" contents: ["POST",'{"data": {"target": {"target": [3, 4, 5]}, "covariates": {"a": [2, 3, 4], "b": [4, 5, 6]}}}', ["Content-Type"::"application/json"]];
msgSent <- msgSent + 1;
}
}
experiment debug {
action _init_ {
create simulation;
}
output {
}
}
Java.lang.ClassCastException: class gama.core.util.GamaMap cannot be cast to class java.lang.String (gama.core.util.GamaMap is in unnamed module of loader org.eclipse.osgi.internal.loader.EquinoxClassLoader @26f5a6cd; java.lang.String is in module java.base of loader 'bootstrap')
at gama.extension.network.httprequest.HTTPRequestConnector.send(HTTPRequestConnector.java:134)
at gama.extension.network.skills.NetworkSkill.effectiveSend(NetworkSkill.java:472)
at gama.core.messaging.MessagingSkill.primSendMessage(MessagingSkill.java:121)