Replies: 2 comments 2 replies
-
Thanks @dagohan this is a really good point you make. This was in the previous version but I didn't bring it over during the Typescript rewrite. How do you feel about something like this wow.characterProfile({ name: string, realm: string }, headers: { [key: string]: string }) Some API methods accept no arguments (mainly for "index" endpoints) so the first argument would become wow.achievements(undefined, headers: { [key: string]: string })
wow.achievements(null, headers: { [key: string]: string }) I think I had the foresight to also anticipate if an empty object is passed so this would also work for "index" endpoints wow.achievements({}, headers: { [key: string]: string }) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi 👋, awesome job on covering the battle-net API!
I checked if there is support to add headers to the requests, but couldn't find it and traced how requests are generated to here:
blizzard.js/src/core/index.ts
Lines 80 to 93 in 7e2aa4a
It is relying on default headers (also dynamically sets
Battlenet-Namespace
based on the resource) but other than that the user does not have any control over it.I think it would be beneficial to allow users to pass optional headers to any resource. For example, some requests can potentially return large response bodies and the user might want to avoid this if the resource has not been updated between the previously observed state. Blizzard API supports
If-Modified-Since
header for such purpose but it is not possible to utilize it behindblizzard.js
's abstraction.Beta Was this translation helpful? Give feedback.
All reactions