typicode / fetchival

Easy window.fetch requests
MIT License
522 stars 33 forks source link

Update documentation #17

Closed DaddyWarbucks closed 2 years ago

DaddyWarbucks commented 8 years ago

I noticed that that README says you can do soemthing like this:

//posts/1
posts(1).get()

This leads me to believe that the method will issue a request to /posts/1, but this is not actually the case. The method actually builds a querystring /user?. If I make the number a string, I get this : /user?0=1.

What is the intended behavior? Attach?

ernstki commented 7 years ago

Just out of curiosity: are you sure that you made posts exactly like it was shown in the documentation (var posts = fetchival('/posts'))?

I used the same method shown in the README in a toy application, and it worked fine. Here's a small example that also seems to work exactly as demonstrated in the README, using GitHub's API:

var ghrepos = fetchival('https://api.github.com/repos')  
ghrepos('typicode/fetchival').get().then(function(json){console.log(json)})  
// logs: Object { id: 34301319, name: "fetchival", full_name: "typicode/fetchival", ... }