-
Notifications
You must be signed in to change notification settings - Fork 496
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
Allow optionally setting API call Headers #26
Conversation
```javascript | ||
spotifyApi.getPlaylist('odesza','0uxUkSQHZVM7so7msXl9Ck', { headers: { 'If-None-Match': 'AAAANPBn03qInch471K02Rncz5IHWVja'} }) | ||
.then(function(data) { | ||
if(data.statusCode !== 304) |
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.
Minor formatting comment, but if and parentheses should have a space between them according to Code Conventions for the JavaScript Programming Language.
Thanks a lot for this pull request @UnbounDev! This change makes total sense and should've been included in the 2.0.0 version. A couple of thoughts:
@JMPerez, any usability concerns? E.g. {
"headers" : {
"If-None-Match" : "cachedEtagValue"
},
"limit" : 10,
"offset" : 15
} Other options to this would be to split the |
@thelinmichael Some wrappers use an object with a key for the data, and another key for headers, like $.ajax({
...
headers: {
"If-None-Match" : "cachedEtagValue"
},
data: {
"limit" : 10,
"offset" : 15
}
}) That would keep the data separated from the headers and would prevent collisions. Although very unlikely, we might have a What I wouldn't like to see is having both |
@thelinmichael apologies, your're correct I ought to have followed gitflow (it was a late night). @JMPerez thelinmichael makes a great point, I'd prefer to redo this work under a feature branch (if only to maintain an appropriate version sequence - this PR should only be
If at a later date there is a need for a query param |
Reopening this PR in #47 |
thelinmichael's work to provide access to response headers in PR #25 is awesome, this PR completes the loop by allowing users to set the Header values when making API calls.