Giter Site home page Giter Site logo

Comments (8)

kafoso avatar kafoso commented on May 31, 2024
  • 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.

viglucci avatar viglucci commented on May 31, 2024

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.

benweier avatar benweier commented on May 31, 2024

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.

viglucci avatar viglucci commented on May 31, 2024

Thanks @benweier!

Looking forward to an update.

from battlenet-api.

benweier avatar benweier commented on May 31, 2024

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.

viglucci avatar viglucci commented on May 31, 2024

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.

benweier avatar benweier commented on May 31, 2024

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.

benweier avatar benweier commented on May 31, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.