unsplash / unsplash-js

🤖 Official JavaScript wrapper for the Unsplash API
https://www.npmjs.com/package/unsplash-js
MIT License
2.15k stars 157 forks source link

apiUrl not respected in browser app #156

Closed djfdev closed 3 years ago

djfdev commented 3 years ago

Steps to Reproduce

1) Create an unsplash instance with proxy URL:

const unsplash = createApi({
  apiUrl: 'http://localhost:4000/proxy'
})

2) Call some method

unsplash.search.getPhotos({
  query: 'cats'
})

Observed Behaviour

HTTP request goes directly to Unsplash:

image

Expected Behaviour

Request should go to my proxy at the specified apiUrl, not directly to unsplash.

Technical Notes

samijaber commented 3 years ago

I can't reproduce. I tested in here https://stackblitz.com/edit/unsplash-js-example-api-url?file=index.tsx with the same apiUrl you provide, and I can see it in the logs that the request goes to the proxy URL and not to api.unsplash.com. If you can show me a way to reproduce then I can help.

djfdev commented 3 years ago

Apologies, I just updated Chrome and this is working as expected with my example code shared above. Thanks for taking a look.