Hi, this board has been super helpful! I was able to get a script to replace an image with a URL just fine with some sample image URLs. However, I'm now switching over our API which needs to be authenticated with a cookie. Even image URLs. This is the code I'm using for the original samples:
var fetchedData = NSData.dataWithContentsOfURL(NSURL.URLWithString(imageURL));
var imageData = NSImage.alloc().initWithData(fetchedData);
var image = MSImageData.alloc().initWithImage(imageData);
Is there any way to set a header with a cookie for NSData? I found this
[theRequest setValue:@"myCookie=1234" forHTTPHeaderField:@"Cookie"]
But I don't know if there's a way to set a header value with the current JS API. Also, maybe there's another way to go about getting the image that's easier using a cookie? Could I possibly fetch it (all my other api calls using fetch work just fine sending a cookie)?
Thanks for any help!