-
Notifications
You must be signed in to change notification settings - Fork 780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: console warning added when using an invalid API key #1077
Conversation
this.defaultHeaders = { | ||
'Accept': 'application/json', | ||
Accept: 'application/json', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we convert to a non-string key here? Why only for the Accept
key?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quotes aren't needed here and is an eslint warning.
setApiKey(apiKey) { | ||
this.apiKey = apiKey; | ||
|
||
if (!this.isValidApiKey(apiKey)) { | ||
console.warn(`API key does not start with ${API_KEY_PREFIX}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is a spot to put the message: https://github.com/sendgrid/sendgrid-nodejs/blob/master/packages/helpers/constants/index.js -- nit: period at the end.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's in the helpers package. I don't like defining the message in 1 package and using it in another.
Fixes #1068