Comments (6)
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.
@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.
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.
@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.
Thanks @lpellegr! 👏👏👏
from ipregistry-javascript.
@lpellegr works perfectly! That commit was too fast! Thanks!!!! 🎉🎉🎉
from ipregistry-javascript.
Related Issues (8)
- make number of lookups which are cached configurable HOT 3
- TypeScript Typing for Language Section Contains Mismatch HOT 2
- import issues with Svelte / Sapper Project HOT 6
- `is_tor_exit` not available as type HOT 2
- Return Remaining Credit and Rate Limit from http response headers HOT 2
- 404 Not Found - GET https://registry.npmjs.org/@ipregistry%2fclient - Not found HOT 3
- Access to remaining credits returns `null` HOT 8
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 ipregistry-javascript.