Home > other >  How do i fetch data with Axios that isn't json data
How do i fetch data with Axios that isn't json data

Time:11-27

How do i fetch data with Axios that isn't json data. such as data just from a website the data i want to fetch

CodePudding user response:

You can use the API that has already been given by them.

Here is a link to that https://apidocs.imgur.com/

CodePudding user response:

Use option responseType

Example download image: https://stackoverflow.com/a/53230807/6250402

  // `responseType` indicates the type of data that the server will respond with
  // options are: 'arraybuffer', 'document', 'json', 'text', 'stream'
  //   browser only: 'blob'
  responseType: 'json', // default

Read more: https://github.com/axios/axios

  • Related