unsplash/unsplash-js

apiUrl not respected in browser app

djfdev opened this issue · 2 comments

Steps to Reproduce

  1. Create an unsplash instance with proxy URL:
const unsplash = createApi({
  apiUrl: 'http://localhost:4000/proxy'
})
  1. 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

  • v7.0.2
  • Potentially related to fix for #154

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.

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