Coder Social home page Coder Social logo

Comments (6)

lpellegr avatar lpellegr commented on June 15, 2024 1

Oops, I read your original message too quickly. Sorry about that.

An option is to pass a custom RequestHandler implementation that overrides the default one. However, that's really not convenient. Furthermore, I agree with you that we could pass the API key as a header by default.

I will make the changes by Friday, release a new version, and let you know.

from ipregistry-javascript.

lpellegr avatar lpellegr commented on June 15, 2024 1

@matiaslopezd It was faster than expected. I have published version 3.1.0:

https://www.npmjs.com/package/@ipregistry/client

Please let me know whether it works as desired.

from ipregistry-javascript.

lpellegr avatar lpellegr commented on June 15, 2024

The solution to use really depends on your use case. As you said, using a header is a good practice in general. You can find an example of how to use the Authorization header on the next page:

https://ipregistry.co/docs/authentication#content

from ipregistry-javascript.

matiaslopezd avatar matiaslopezd commented on June 15, 2024

@lpellegr thanks, but I try to do with this library. Now I see that is possible to send options to IpregistryClient like apiKey, timeout, and apiUrl in the first param.

const {IpregistryClient, DefaultCache, IpregistryRequestHandler} = require('@ipregistry/client');

const options = { apiKey, timeout, apiUrl };
const cache = new DefaultCache(1000, 3600000);
const iDontKnowWhatParamsReceiveThisFunction = IpregistryRequestHandler(??);
const client = new IpregistryClient(options, cache, ???);

There is documentation related to these params? I want to send the API key on headers :)

Thanks!

EDIT: I want to use the cache feature of this library, that's the reason why I don't a simple request with "Authorization" header from my server.

from ipregistry-javascript.

matiaslopezd avatar matiaslopezd commented on June 15, 2024

Thanks @lpellegr! 👏👏👏

from ipregistry-javascript.

matiaslopezd avatar matiaslopezd commented on June 15, 2024

@lpellegr works perfectly! That commit was too fast! Thanks!!!! 🎉🎉🎉

from ipregistry-javascript.

Related Issues (8)

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.