Comments (8)
- By default, Javascript hoists functions. Even so, did you try to move the
callback
function above the API request line? - Did you check if
err
contains any information?
from battlenet-api.
err is null.
I am able to successfully make calls with characters whos names do not contain accented characters, I do not think the positioning of the function definition has any affect.
from battlenet-api.
Thanks @viglucci I think I know what the issue is so I'll test my theory tonight and probably push a fix out tomorrow.
from battlenet-api.
Thanks @benweier!
Looking forward to an update.
from battlenet-api.
Hey @viglucci My suspicion was correct and the character encoding is what's causing the API request to fail. I've been able to test a successful request by calling the character method with a URI encoded value.
var params = {
origin: 'us',
realm: 'alterac-mountains',
name: encodeURIComponent('Facelìft')
};
bnet.wow.character.statistics(params, callback);
While looking at fixing the issue I realised there are some potentially far-reaching consequences. Some developers may perform their own encoding while others may not, so I would like to provide automatic encoding by default with an option to disable it.
I think I can also improve the request methods so that I'm not adding a bunch of duplicate encodeURIComponent()
calls but route all requests through a single function to properly encode all of the API parameters.
from battlenet-api.
I might suggest not encoding by default, with an option to enable the encoding. Most of the battle.net API libraries I've used in the past have required the developer to provide the properly encoded strings.
from battlenet-api.
Thanks @viglucci I'll take that into consideration. Perhaps the best thing is to put an encoding recommendation into the documentation. At the very worst, developers who don't encode their input simply get no results.
from battlenet-api.
@viglucci because of the relative low impact of adding optional parameter encoding, I've added some info to the documentation and will leave it at that. Thanks again :)
from battlenet-api.
Related Issues (13)
- Usage in Context HOT 2
- Easier method of selecting item with bonus lists. HOT 1
- More explicit method of selecting context
- Support for Heroes of the Storm? HOT 4
- wow.realmStatus "realms" parameter is not optional HOT 1
- Realm status error with undefined realms array HOT 2
- Character API missing Profession infos HOT 2
- Plans to support promises? HOT 2
- Allow changing host and apikey on the fly. HOT 6
- Typo in property name - "data.characterAchievements" HOT 3
- Unable to get China origin for "bnet.wow.pvp.leaderboards" HOT 1
- bnet.account.id (etc.) cause "args is not defined" in users.js HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from battlenet-api.