-
Notifications
You must be signed in to change notification settings - Fork 445
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
Default headers support #206
Conversation
a19989f
to
5f29461
Compare
@Kronuz Thanks for your PR, and I am considering that if we could directly provide a setting like |
That sounds also good... probably even better! Still, I’d get rid of One thing I stumbled upon while making the pull request is I had to create a new instance of the |
I am also considering this question that in current code, every place needs to reference the settings, they have to create a new instance of the RestClientSettings class. My suggestion is that, it seems there's no need to hold many instances of setting class, can we just leverage the singleton pattern. That means add a new public static function which is responsible for creating a setting instance internally if not exists, otherwise return the created one. And the constructor of it can be even made private. |
da8eb91
to
46d4f4f
Compare
@Huachao, I modified and added what you suggested to this pull request (defaultHeaders) 👍 |
src/httpClient.ts
Outdated
@@ -83,8 +83,13 @@ export class HttpClient { | |||
} | |||
|
|||
// add default user agent if not specified |
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.
Please update the comment as well.
@Kronuz please also update your code related to settings, since I have used the singleton pattern for Settings class. Thanks for your contribution. |
@Huachao, done! I've changed it to use singleton settings and fixed the comment as well. 👍 |
@Kronuz Merged, Thanks! |
Great! will you make a release any time soon? I can't wait to use the official extension again :) |
@Kronuz Sorry, the release will not happen in the immediate future. However I will notify you as soon as it happens |
It’s ok, thank you! 👍 |
@Kronuz you could test the latest version 0.19.0 to experience this feature, thanks for your contribution. |
Can variables be used in the settings file for defaultHeaders ?? |
This adds the feature in #205 by adding the following settings: