Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

How to return a PNG image in the response payload?

Not applicable

I want to return a PNG image in the response payload. I am retrieving the image from an API that I call in a JavaScript file used by a JS Policy in the proxy. I have included the code snippet from JS file below but it is not working (with credentials inserted, of course). The variable "response" stays undefined even after the API call.

var req = new Request("https://tile2.aerisapi.com/credentials/current_temps/500x500/40/-105/10/0.pn",
                      'GET'
                      ); 
var exchange = httpClient.send(req);
exchange.waitForComplete();
var response = exchange.getResponse(); 
var responseObject = response.content;
print(response);
1 8 20.5K
8 REPLIES 8