Questions tagged [node-fetch]
462 questions
0
votes
1 answer
Trello API - Create a new Card - name
I'm trying to create a new card in JavaScript with the Trello API. I have this:
const fetch = require('node-fetch');
fetch(`https://api.trello.com/1/cards?key=${key}&token=${token}&idList=${listId}&desc=test&name=${name}`, {
method: 'POST'
})
It…

BJnator
- 5
- 1
0
votes
0 answers
Nodejs 2nd call on same external API return previous result
I am writing a service In which I have to register an order tracking number to an external source to track my order automatically.
let trackingObj = {
tracking: {
tracking_number: params.trackingNumber,
order_id: params.orderId,
…

Waleed Ahmad Qureshi
- 114
- 8
0
votes
1 answer
Correct way to calculate download percentage with node-fetch
I have the following method installFile which downloads a file to disk from S3. The code works perfectly. I've removed a bunch of irrelevant code and only included the part that I'm struggling with.
What I'm trying to do is console.log the download…

rock_n_rolla
- 337
- 4
- 13
0
votes
1 answer
Strange value begin inserted at the beginner of query string on Node URL request
I'm with a tricky problem here. I have created an API that will fetch some data from an external API. For example:
I have this endpoint on my current api:
/api/items?q=
And on the route responsible for that, I have this code:
itemsRouter.get("/",…

Otavio Augusto
- 316
- 3
- 9
0
votes
1 answer
How to get node-fetch's data in PHP?
I'm trying to make an application that sends JSON data to PHP server, and get responses from it. I'm using JavaScript node-fetch library for it.
Here is my sample code:
const fetch = require("node-fetch");
let data =…

sundowatch
- 3,012
- 3
- 38
- 66
0
votes
1 answer
Receiving a CORS error when to my react app using fetch function
I received the dreaded CORS error when hooking up my API. I am using the BeerDB one. I tried the plugin, adding the header, going into index.js but it does not seem to solve it. Still looking into it, my code for my App.js is below. It is a React…

voteforpedro
- 45
- 1
- 1
- 3
0
votes
1 answer
Async array.map returning undefined
I can't quite work out why my async map fetch function returns an array of undefined values or "Promise { }" no matter what I do. My getImageRef function works (I've tried to simplify it by stripping some bits out) but how do I get it to return…

j-adom
- 1
0
votes
1 answer
Webpack devServer forward with Cookies
I am using Webpack devServer before to intercept requests, then use node-fetch to retrieve html file from remote. How can I preserve Cookies with that approach?
before: function (app, server, compiler) {
app.get('/*', function (req, res, next)…

licaomeng
- 919
- 2
- 13
- 27
0
votes
0 answers
Is there a way to define a type definition for an object with changing property names in GraphQL?
I am working on retrieving data from an API with graphql-yoga and node-fetch (in node.js). This is how my code looks like:
const {GraphQLServer} = require('graphql-yoga');
const fetch = require('node-fetch');
const typeDefs = `
type Query {
…

Leon Peter
- 139
- 1
- 1
- 7
0
votes
0 answers
My promise in a promise is returning
I have this (extracts):
index.js:
searchSerial: swName => {
return new Promise(async (resolve) => {
const url = rawUrl + '?chto=' + swName.replace(' ','+')
const $ = cheerio.load(await (await fetch(url)).text())
…

Wxcc
- 19
- 10
0
votes
1 answer
Google Cloud Functions req/res with Promise by node-fetch
I am a total newbie to Javascript and trying to set up a bridge between two of the services I use. The goal is simply take body or the request, do a promise api call to another service to respond with the body of that api call. I have been able to…

Yuri Vaskovski
- 3
- 2
0
votes
1 answer
Retrieve Response query using node-fetch
One day I was busy using node-fetch to make an HTTP Request, and tried to retrieve the Response Text. When using Chrome Dev Tools, you can get this information in the Response tab. Like This:
The method of request does not matter.
I am trying to…

ßrilliant
- 144
- 1
- 11
0
votes
1 answer
Compare the HTML of 2 pages using fetch
I'm trying to compare 2 URLs, which should be identical, however for some reason I'm getting there's some difference. I'm wondering if there's something fundamental I'm misunderstanding with NPM fetch.
Here's my example code:
const fetch =…

userMod2
- 8,312
- 13
- 63
- 115
0
votes
1 answer
Required request part 'config' is not present node-fetch
I'm trying to convert this curl command to a node fetch request.
curl -X POST http://localhost:7200/test -H 'Content-Type: multipart/form-data' -F "config=@test.ttl"
What I have so far sends the file as formdata via a POST request, just…

jtrugman
- 23
- 7
0
votes
1 answer
building a node download module with moderate complexity
I'm buildinga download module for an Electron Node app, want to try node-fetch and have a few questions.
How can i get the total fileSize so i can implement a progress?
How can i pause/resume/cancel a download?
Also examples using other…

Cristian Muscalu
- 9,007
- 12
- 44
- 76