class Person
{
constructor(name)
{
this.name = name;
let r = fetch("/test", {method:"POST", body: JSON.stringify({x: this.name}), headers:{'Content-type': 'application/json; charset=UTF-8'}});
return r;
}
}
async function run()
{
const p = new Person("john smith");
let r = await p;
console.log(await r.json());
}