My function looks like this:
async function getPlaceForecast(lat, long) {//var response;var day5forecast = 'http://api.openweathermap.org/data/2.5/forecast?lat='+ lat +'&lon='+ long +'&appid='+ apikey;try { const request = new Request(tmp2, { method: 'get' }) let response = await fetch(request) .then(value => { console.log("than", value.json()); return value//.json(); }) .catch(function (error) { console.error(error); });}catch{}//return response;
}
This is the result:
'than', { _40: 0, _65: 0, _55: null, _72: null }
And this is the result without using .json() :
'than', { type: 'default',status: 200,ok: true, statusText: undefined, headers: { map: { 'access-control-allow-methods': 'GET, POST','access-control-allow-credentials': 'true','access-control-allow-origin': '*','x-cache-key': '/data/2.5/forecast?lat=28.35&lon=-14.05', connection: 'keep-alive','content-length': '14383','content-type': 'application/json; charset=utf-8', server: 'openresty' } }, url: 'http://api.openweathermap.org/data/2.5/forecast?lat=28.349414&lon=-14.046311&appid=<mykey>', _bodyInit: { _data: { size: 14383, offset: 0, blobId: '2dbf82c5-5d28-47db-9034-7f239bf8290a' } }, _bodyBlob: { _data: { size: 14383, offset: 0, blobId: '2dbf82c5-5d28-47db-9034-7f239bf8290a' } } }
What did I do wrong?