0

I have a C# library with a Login() method that returns an HttpClient which is to be used in subsequent calls (to get more pages after login). In a C# app I would make a Login() call, save the returned HttpClient and then make as many calls as I want for other pages.

Is that possible using edge in NodeJS? Is it possible to return a complex object (HttpClient) to NodeJs and then have NodeJS pass this object when making the next call?

Nicolae Daian
  • 1,065
  • 3
  • 18
  • 39

1 Answers1

0

It is definitely possible to pass complex objects from one js call to another.

You can return a javascript object from a function as well as "callback" a javascript function with the new object as a value in the callback's arguments.

E.G:

function hasCookie(req,callback){
    if(req.headers['cookie']){
        callback(req.headers.cookie,req);
    }
    return req;
}

You can even "chain" calls together, as long as the object in question supports the given methods.

Patrick Sturm
  • 393
  • 1
  • 13