Skip to content
Advertisement

Why I can get and api data with fetch and not with axios?

I got this test code:

JavaScript

I’m trying to understand why readWithFetch works fine and axios gets connection refused. It’s a simple basic auth… nothing fancy.

I’ve tried all these readWithAxios versions:

version 1

JavaScript

version 2

JavaScript

version 3

JavaScript

version 4

JavaScript

What is the correct way to write readWithAxios ?

Advertisement

Answer

You have a triple slash in https:///geolite in the Axios versions. It should be https://

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement