Closed DavideVitali closed 3 years ago
Ok, I was referring to help in the npm page... I should have called 'swapi.fetchPlayer' instead, as 'swapi.fetch' calls the node-fetch method. Now I'm getting another error (malformed payload), but I'll investigate further before opening another issue.
Expected behaviour
swapi.fetch( 'player', payload )
should return a promise.Actual behaviour
Following code results in error:
Stack trace:
(node:4340) UnhandledPromiseRejectionWarning: TypeError: Only absolute URLs are supported at getNodeRequestOptions (C:\Users\Davide\Documents\repos\test\node_modules\node-fetch\lib\index.js:1305:9) at C:\Users\Davide\Documents\repos\test\node_modules\node-fetch\lib\index.js:1410:19 at new Promise (<anonymous>) at SwgohHelp.fetch (C:\Users\Davide\Documents\repos\test\node_modules\node-fetch\lib\index.js:1407:9) at getPlayers (C:\Users\Davide\Documents\repos\test\index.js:10:50) at Object.<anonymous> (C:\Users\Davide\Documents\repos\test\index.js:18:1) at Module._compile (internal/modules/cjs/loader.js:1063:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) at Module.load (internal/modules/cjs/loader.js:928:32) at Function.Module._load (internal/modules/cjs/loader.js:769:14)
Installed dependencies: