Questions tagged [fetch]

DO NOT USE. For questions about the JavaScript Fetch API, use the [fetch-api] tag instead. For the git subcommand, use [git-fetch]. This tag is ambiguous.

fetch is used in many contexts, include source control, database querying, and cache control.

References

11193 questions
2
votes
0 answers

Random TypeError: Failed to Fetch

I'm creating a web application which takes in user input and queries a flask application using a fetch request. Sometimes, this runs correctly but it randomly returns the following error message. Can you please help me fix this error? This is an…
2
votes
0 answers

Access to fetch at _ from origin _ blocked by CORS policy: Response to preflight request doesnt pass access control check: doesnt have HTTP ok status

I'm trying to make authorized requests to LinkedIn's API after using OAuth2.0 to sign in users. I keep getting errors regarding the CORS policy and need help in sending the correct headers so that I no longer get these errors. I've tried including a…
Skye Brown
  • 357
  • 1
  • 5
  • 13
2
votes
2 answers

How to update props after getting fetch data

i am trying to get data from fetch , and ''refresh'' the page , with new props that their value is the data from fetch submit = () => { let user = { email: this.props.email, newuser:…
Vagtse
  • 121
  • 1
  • 15
2
votes
1 answer

How to service error if there is not specific key, but it should be

I'm using fetch on https://www.googleapis.com/books/v1/volumes?q=wiedzmin . If you go to this link you can see that it is not any volumeInfo.authors in 9th object (from line 545 to 602). It gives me an error: Uncaught (in promise) TypeError: Cannot…
Baldini
  • 97
  • 1
  • 4
2
votes
2 answers

React Native: Remove Expo Cookies

I'm building a Expo/React Native app where I use fetch and credentials (cookies) to log into a server. The code works properly and looks like this: login = async (email, password) => { try { var body = JSON.stringify({ email,…
user3601578
  • 1,310
  • 1
  • 18
  • 29
2
votes
2 answers

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 can help me? Here is the code: function getPosts()…
hobboh
  • 27
  • 3
2
votes
2 answers

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 know where I am doing the mistake(s). The idea is…
onlycparra
  • 607
  • 4
  • 22
2
votes
0 answers

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] [AllowAnonymous] public async Task
si2030
  • 3,895
  • 8
  • 38
  • 87
2
votes
1 answer

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.com/nodejs/incorrecturl") .then(res => res.json()) …
Shanmu_92
  • 835
  • 1
  • 7
  • 20
2
votes
1 answer

How to load and parse .xlsx file using fetch API and XLSX library

I'm importing these library: and trying to fetch & parse local file saved in my…
Axel Stone
  • 1,521
  • 4
  • 23
  • 43
2
votes
1 answer

Fetching and downloading Maven artifacts programmatically

I'am looking for a way to search and find some packages (OSGi bundle) from maven central repository, then to download them programmatically (java) or just get the link of them. Is their any way or library to achieve this ? Thanks
Heisenberg1
  • 49
  • 1
  • 6
2
votes
1 answer

How can pass mode cors to fetch in typescript?

I'm trying to do fetch in this google api 'https://maps.googleapis.com/maps/api/place/autocomplete/json' with the following code, but i received cors error, I already try to put mode: 'cors', but typescript complains that string is not a…
2
votes
2 answers

How to console log the whole content of error in the catch block of a fetch call when there is a network failure

I am making a network request in a react native project using the fetch api. It works well in normal conditions but when I am offline the catch block just gives as result of the logging error but when I do err.message I get "Network request failed"…
harisu
  • 1,376
  • 8
  • 17
2
votes
1 answer

POST method doesn't work (Fetch or Axios) in a react-native app (Android)

I'm doing an API CALL width POST method either with Axios or Fetch but send the wrong Content-Type on Android. Send application/json; charset=utf-8 instead of application/json It's working fine on iOS and GET method seems to work well on both…
Clément CREUSAT
  • 301
  • 3
  • 6
  • 13
2
votes
0 answers

How can i return rejected from async-await?

I would like to return rejected, when fetch request is fail. How can i reject async await? class FetchUrl { static async getJson(api) { try { const response = await fetch(api); if (response.ok) { const questions =…
Rafal9626
  • 39
  • 5