Skip to content
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

chore: Make header names that always need to be sent constants #38

Merged
merged 7 commits into from
Apr 1, 2022

Conversation

poppoerika
Copy link
Contributor

This is a follow-up pr for the implementation option 2 mentioned here.


namespace MomentoSdk
{
class Header
{
public readonly List<string> onceOnlyHeaders = new List<string>{"Agent"};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for making this change.

Can you also make "Agent" and "Authorization" constants in this class and use them here and where you are actually setting the headers?


namespace MomentoSdk
{
class Header
{
private const string Agent = "Agent";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think we should add this in each file. Define once and reference in each class.

e.g. drop the constant private here

const string AGENT_KEY = "Agent";
const string AUTHORIZATION_KEY = "Authorization";

And then in DataGrpcManager reference in Headers.AGENT_KEY

Copy link
Contributor

@gautamomento gautamomento Apr 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And just one note, you probably should looking up naming conventions for C# for constants AGENT_KEY is what is done in Java. So, check the appropriate C# guideline. May be it is exactly how you have defined here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like FullProductName is its naming convention for constants.
https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/const

Copy link
Contributor

@gautamomento gautamomento left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for doing this.

LGTM

@poppoerika poppoerika merged commit 9131cd8 into main Apr 1, 2022
@poppoerika poppoerika deleted the chore/updateAgentMetadataLogic branch April 1, 2022 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants