Skip to content

Conversation

YomesInc
Copy link
Contributor

@YomesInc YomesInc commented Jul 9, 2021

No description provided.

ApiShared.USER_AGENT = userAgent;
try
{
var httpRequestMessage = CreateRequest("UserPlatform");
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better also to check that it is serialized correctly

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@const-cloudinary We think that such a check would be complicated and nonobvious (need to use regex etc. like in TestAgentPlatformHeaders). These tests were added to assert that "bad" data won't break anything — DoesNotThrow seems to be fine here.

/// User agent for cloudinary API requests.
/// </summary>
public static string USER_AGENT = BuildUserAgent();
public static string USER_AGENT = RuntimeInformation.FrameworkDescription;
Copy link
Contributor

Choose a reason for hiding this comment

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

The name of this constant does not correspond the content. Very confusing. Please refactor.


private void SetUserPlatform(HttpHeaderValueCollection<ProductInfoHeaderValue> userAgentHeader)
{
Console.WriteLine($"UserPlatform: [{UserPlatform}] ======");
Copy link
Contributor

Choose a reason for hiding this comment

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

Please remove debug printing.

var productVersion = GetElement(1);
if (string.IsNullOrEmpty(productVersion))
{
productVersion = "0.1";
Copy link
Contributor

Choose a reason for hiding this comment

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

"0.1" ? is there any special meaning?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@const-cloudinary No special meaning here, just a default value.

return;
}

var normalizedComment = RemoveBracketsFrom(comment);
Copy link
Contributor

Choose a reason for hiding this comment

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

Please explain the problem we are solving here. In a year nobody will remember why we remove brackets from headers.

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