-
Notifications
You must be signed in to change notification settings - Fork 20
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
Add global headers to the client #218
Conversation
can we add more tests? Here is what I would like to see:
|
src/client/client.ts
Outdated
private wrapWithGlobalHeaders(headers: Headers) { | ||
const finalHeaders = new Headers(this.headers); | ||
|
||
// eslint-disable-next-line unicorn/no-array-for-each | ||
headers.forEach((value, key) => { | ||
finalHeaders.set(key, value); | ||
}); | ||
|
||
return finalHeaders; | ||
} |
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.
private wrapWithGlobalHeaders(headers: Headers) { | |
const finalHeaders = new Headers(this.headers); | |
// eslint-disable-next-line unicorn/no-array-for-each | |
headers.forEach((value, key) => { | |
finalHeaders.set(key, value); | |
}); | |
return finalHeaders; | |
} | |
private wrapWithGlobalHeaders(headers: Headers) { | |
const finalHeaders = new Headers(this.headers); | |
// eslint-disable-next-line unicorn/no-array-for-each | |
headers.forEach((key, value) => { | |
finalHeaders.set(key, value); | |
}); | |
return finalHeaders; | |
} |
Why do we even have this function? Are we trying to reverse the headers' key value? The user should already give them as
const clientWithHeaders = new Client({
token: process.env.QSTASH_TOKEN!,
headers: {
"test-header": "value",
"test-header-2": "value-2",
},
});
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.
It is reversed in the api for no reason. It seemed weird to me too
how about schedules & enqueue? |
Example usecase: