Questions tagged [fetch]

For questions about the Fetch API, use the [fetch-api] tag instead. For the git subcommand, use [git-fetch]. The [fetch] tag is a general-purpose tag for the keyword used in many programming languages, which is usually part of an instruction to retrieve data.

0
votes
0answers
13 views

Strange Array Result with JSON [duplicate]

Here is the piece of code i've used: response.json().then(function(data) { var sex = data.map(x=>{ if(x.gender ==="MALE"){ males.push(x.name); } else{ ...
0
votes
0answers
12 views

Fetch API does not see URL

let headers = new Headers(); headers.set("Content-Type", "application/json"); headers.set("Authorization", "Basic " + btoa("<username>" + ":" + "<pwd>")); let inits = { headers: ...
0
votes
0answers
11 views

Why my getRequest() in saga doesn't see data from json.db after postRequest

My saga.ts : export function* postSomething(object:object){ yield postRequest(object); const Objects=yield getRequest(); console.log(Objects); yield put(showObject(...
1
vote
1answer
23 views

How can I get data from the acf.maps field?

I tried to make a simple fetch from the Wordpress API. In this case from ACF Fields. With the code: I get a response. But if I try to add ${post.acf.address} there are no data. But why, anyone who ...
0
votes
0answers
10 views

Nodejs module request delete the cookie at the end of the post call

Is there a possibility to delete the cookie at the end of the post call? I set the jar: true, but I would like to end the res.send (..) before deleting the cookie.
2
votes
2answers
59 views

How to send and receive json data betweeen javascript and servlet?

The Problem I cannot get to work the communication between a client with html/javascript sending the data of a form as json to a servlet, and then, the servlet replaying json back. I don't exactly ...
1
vote
0answers
23 views

Javascript fetch - trouble reading a bad request response

I have a asp.net core server which, in this case, has been intentionally sent a fetch that produces a bad request response. Here is part of the controller that does that: [HttpPost] [...
0
votes
1answer
34 views

Retrieving data from Shopify Storefront API [on hold]

I am make a simple request to grab data from the Shopify Storefront API. I have confirmed that the store URL and the Storefront access token for my private app are correct. The error I receive is { ...
0
votes
0answers
15 views

Fetch() response header is null even though chrome dev tools shows header

The response to a HEAD request that's made from within my chrome extension omits a custom header that I need called "Replay-Nonce". I think it has something to do with CORS blocking it but I'm not ...
0
votes
0answers
15 views

How to upload an image file directly from client to AWS S3 using node, createPresignedPost, & fetch

I'm generating an AWS S3 presigned post object on my server using s3.createPresignedPost(). I'm then trying to upload a file directly to the S3 bucket from the client using fetch using the presigned ...
0
votes
4answers
34 views

Typescript(or Javascript) Fetch API async/await error handling

I want to use async/awayt syntax, Fetch API and want to achieve the following behavior: if the response is not 200, log the response, don't throw anything and return null. if the response is 200, ...
0
votes
1answer
25 views

How do I fetch on an update to a url containing JSON?

I am running a couple of arduino mini's who send JSON data to a url-path on my website. Currently I have managed to fetch the data just fine, but would like to fetch upon JSON changes to the url, ...
0
votes
0answers
13 views

Override fetch api in typescript REACT NATIVE application

I am trying to override fetch api in typescript in my REACT NATIVE application. The reason why I am trying to do so is to update some state variables before and after every network request. So I need ...
1
vote
1answer
28 views

Fetch only once data from twitch API

I need to do 3 request to the twitch API (grap the info about the live, about the streamer and the game). I can't to it one shot because the data from the live is not already available for fetch the ...
0
votes
0answers
7 views

Axios/Fetch can't set headers 401 unautorized [duplicate]

I am trying to hit service by get request and it is using basic auth. Response is XML. What i get is. 1) in first configuration I get 401 in console but second line is 'data' but not data response ...
-3
votes
0answers
14 views

Having trouble with fetchall and writing out to a file [on hold]

Hey guys hope you can help. I need to build something that will fetch all of my cursor.execute results but my memory isn’t large enough for the fetchall statement so it keeps failing after about 450k ...
0
votes
1answer
21 views

Fetch returns undefined when assigning response to global variable [duplicate]

I'm trying to store the response from a fetch api call in a gloval variable. However, the variable which I store the result in returns undefined. I've tried to use async/await to resolve this issue, ...
0
votes
0answers
30 views

React native fetch and retrieve the page code after the Redirect

I need to retrieve data (the html page code) after redirecting. That is, sending data to a specific url via Post, then if the data is correct, the page is redirected, when the redirect is finished, I ...
1
vote
0answers
49 views

Testing and mocking fetch in async useEffect and async Redux-Saga

I'm testing a functional component, that use React-Hooks and Redux-Saga. I can pass parameters in URL for the component, because they are a login page component. My URL i pass is 'localhost/access/...
2
votes
1answer
27 views

fetch API doesn't show exact error in catch, if URL is incorrect

JavaScript fetch API doesn't returns proper error text if URL is incorrect. It always returns fail to fetch error in catch statement. window.onload = () => { fetch("https://www.w3schools....
-1
votes
1answer
20 views

How to send body to express app with fetch

I am trying to post a form using javascript to an express API endpoint import express from 'express'; import path from 'path'; import cookieParser from 'cookie-parser'; import logger from 'morgan'; ...
0
votes
0answers
14 views

JS Fetch use Chunked Transfer Encoding (translating curl to Fetch)

I'm trying to convert this curl command from the Kaldi docs: curl -v -T test/data/english_test.raw -H "Content-Type: audio/x-raw-int; rate=16000" --header "Transfer-Encoding: chunked" --limit-rate ...
0
votes
0answers
27 views

Convert request to Nodejs in fetch to React-native

I need to convert the following request, which is the following code for react-native: Nodejs: const request = require('request'); var areaRiservata = { url: "https://www.iliad.it/account/", ...
0
votes
1answer
39 views

fetch request from react to express not working

My fetch route from react to express shows a 404 not found error. Here is the code on the client deleteRoom(roomId){ console.log('this is the current user in delete room', this.state....
0
votes
1answer
11 views

Is it possible to fetch a discord message with the 'client' as a parent?

I don't seem to be able to fetch messages from the 'client = new Discord.Client()'. I've searched for this problem and everyone managed to fetch message from msg.channel.fetchMessage() while I need ...
0
votes
0answers
14 views

why is fetch/ajax not working in a ruby rails app on mobile

i have a rails app that am using fetch to send data to my database, function like(x, y){ fetch('/post_likes', { method: 'POST', body: JSON.stringify({post_id: x, ...
-2
votes
1answer
35 views

My fetched data only shows one data instead of showing two (Firebase, Swift)

I am fetching some details from firebase and showing them on UITableView. Each row/cell is supposed to show 2 labels, however, it's showing just one. My Main View Controller: import UIKit import ...
0
votes
2answers
40 views

HTTP fetch request always fails on react-native

I have a backend on my server which doesn't have https configured. Before it worked fine with just http and everything was working. For some reason now I'm getting this error: TypeError: Network ...
0
votes
1answer
34 views

react native post form data with object and file in it using axios

so i want to upload object as data and file as Note to api using axios uploadToServer= () => { const file =this.state.photo let data2 ={sale_id:1, note_type_id:4, ...
0
votes
0answers
22 views

Why is .json() asynchronous in fetch [duplicate]

When using the .fetch() method, I usually use it like so: fetch('https://example.com/') .then(response => { if(!response.ok) throw new Error("A HTTP error occured!"); return response; }...
0
votes
1answer
18 views

Pass fetch success response to child component

I have two component parent and child. I am passing callback function to child component like this. <ChildComponent onFetchRecords={this.onFetchRecords} /> and inside child component I am ...
0
votes
1answer
30 views

How to use fetch to send a variable to a GET request?

I am having an issue with using fetch to send an id which is then sent to a get request in the backend which performs a function. The aim of the function is to delete the element from the JSON file ...
0
votes
0answers
24 views

my async await function isn't waiting for my function to finish before returning a value

My problem is my return at the end is getting printed instantly before all the operations end. If it's this.state, an empty array gets printed because it printed instantly. If I return pop, it gets ...
-1
votes
1answer
29 views

Why a Get request is fired from a Post request when using fetch?

I'm using MVC I'm making a POST request to an action result in a controller using javascript fetch and its working fine, but as soon as the POST request is done i get an error of a GET reuqest! GET ...
1
vote
3answers
36 views

There is print “space” before HTML button value which come from PHP file

I want to print a button value come from PHP fetch but every time the value came with space before the text value for example " ON" and I want it "ON" My code in php file: <?php $...
1
vote
2answers
40 views

How to handle response .json and .text using fetch?

I'm fetching an API that returns a json but when it have an error, it return only a text (In node with express, results are returned with .json({}) and errors with .send('string')), but I can't modify ...
-1
votes
0answers
33 views

CORS problem - Promise works on Browser Simulator but not on Android simulator, same code

I´m trying to get the login information from my server to my mobile application, this promise works on the front-end Web version, Postman and mobile browser emulation, but not on the real device ...
0
votes
1answer
16 views

PDO Fetch and rowCount (PHP) [duplicate]

try { $sql ="SELECT * FROM tbl4 WHERE tur=:tur AND link=:link"; $res = $db -> prepare($sql); $res -> bindParam(":tur",$tur); $res -> bindParam(":link",$link); $res -> execute(); ...
-2
votes
0answers
30 views

Using fetch get request from unsecure HTTP site

I'm trying to do a fetch() from a url with an expired SSL. Currently my code is working but I have to manually go to the url and accept the unsecure page in my browser. The problem is I wan to be ...
0
votes
2answers
35 views

React Native Fetch not working with laravel API Locally

I am trying to fetch laravel API locally in react-native.When I try with remote url it works but it's not working with local server.I am using android studio emulator and react-native => 0.59.8, ...
0
votes
1answer
31 views

getParameter returns null with Fetch API

My problem is that request.getParameter("username") returns null if I use the Fetch API. Without the Fetch API it works fine and returns the value. document.getElementById('login').addEventListener('...
0
votes
0answers
19 views

How to connect a native React App to a Rest API using fetch when the Rest API url is http://localhost:8080/

I need to connect my Rest API project, which was created using Eclipse, with the React project, which was created using WebStorm. My Rest API url is http://localhost:8080/TrnReserve/rest/trains. When ...
0
votes
1answer
39 views

fetch => response.json() request being rejected

I have a website I'm trying to pull some data from. I'm using the window debugger to copy the fetch fetch("website", {"credentials":"include","headers":{"accept":"text/html,application/xhtml+xml,...
0
votes
0answers
36 views

Issue with fetch, response.json()

I am trying to make an api call using fetch method in react-native. I have rn-fetch-blob for uploading images in one screen which is on another different screen. This particular function was for me ...
1
vote
0answers
24 views

Authenticated fetch request is only working half of the time

I am attempting to make an authenticated fetch request from a react component to my django api backend, however it is only working half of the time (usually right after I login and authenticate the ...
-2
votes
0answers
28 views

How can I response JSON from the end? [closed]

I use node-fetch to get response from JSON and my question is how can I get this response sorted from the end to beginning?
0
votes
1answer
34 views

How to fetch element from json in browser console and write it if condition is true

I am looking for solution how to fetch data from vimeo url json and write it if condition is true. For example i have range of videos id so i want get json variable for example author: someauthor and ...
-1
votes
1answer
20 views

How to fix Response: {type: “cors”} when trying to create payment through paypal api

I'm testing fetch API to create a payment with PayPal plus My first fetch function works correctly, I do an Oauth to get the bearer token so I can get my access_token to make my payment post ...
0
votes
1answer
33 views

Blob Data error when fetching react-native

I am using react native to make a chat-like app. Postman is working properly while doing all the requests I made possible in .NET core api. But when I am trying to fetch from react native it gives the ...
0
votes
1answer
34 views

Invalid API Token

I am pretty new to CORS. I am building a React App which simply posts data to a backend API. According to the API documentation I have to send a BASIC Authentication Header along with the request ...

http://mssss.yulina-kosm.ru