Skip to content

Commit dd8355c

Browse files
pbolducebozduman
authored andcommitted
Replace calls HttpStatusCode.Equals with direct comparison
1 parent 46d1a0b commit dd8355c

22 files changed

+46
-46
lines changed

Minio.Functional.Tests/FunctionalTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1313,7 +1313,7 @@ internal static async Task DownloadObjectAsync(IMinioClient minio, string url, s
13131313
CancellationToken cancellationToken = default)
13141314
{
13151315
using var response = await minio.WrapperGetAsync(url).ConfigureAwait(false);
1316-
if (string.IsNullOrEmpty(Convert.ToString(response.Content)) || !HttpStatusCode.OK.Equals(response.StatusCode))
1316+
if (string.IsNullOrEmpty(Convert.ToString(response.Content)) || HttpStatusCode.OK != response.StatusCode)
13171317
throw new InvalidOperationException("Unable to download via presigned URL" + nameof(response.Content));
13181318

13191319
using var fs = new FileStream(filePath, FileMode.CreateNew);

Minio.Tests/NegativeTest.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public async Task TestInvalidObjectNameError()
8181
var ex = await Assert.ThrowsExceptionAsync<InvalidObjectNameException>(
8282
() => minio.StatObjectAsync(statObjArgs)).ConfigureAwait(false);
8383
for (var i = 0;
84-
i < tryCount && ex.ServerResponse?.StatusCode.Equals(HttpStatusCode.ServiceUnavailable) == true;
84+
i < tryCount && ex.ServerResponse?.StatusCode == HttpStatusCode.ServiceUnavailable;
8585
++i)
8686
ex = await Assert.ThrowsExceptionAsync<InvalidObjectNameException>(
8787
() => minio.StatObjectAsync(statObjArgs)).ConfigureAwait(false);

Minio/ApiEndpoints/BucketOperations.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ await this.ExecuteTaskAsync(ResponseErrorHandlers, requestMessageBuilder,
5353
.ConfigureAwait(false);
5454

5555
var bucketList = new ListAllMyBucketsResult();
56-
if (HttpStatusCode.OK.Equals(response.StatusCode))
56+
if (HttpStatusCode.OK == response.StatusCode)
5757
{
5858
using var stream = response.ContentBytes.AsStream();
5959
bucketList = Utils.DeserializeXml<ListAllMyBucketsResult>(stream);
@@ -84,7 +84,7 @@ await this.ExecuteTaskAsync(ResponseErrorHandlers, requestMessageBuilder,
8484
catch (InternalClientException ice)
8585
{
8686
return (ice.ServerResponse is null ||
87-
!HttpStatusCode.NotFound.Equals(ice.ServerResponse.StatusCode)) &&
87+
HttpStatusCode.NotFound != ice.ServerResponse.StatusCode) &&
8888
ice.ServerResponse is not null;
8989
}
9090
catch (Exception ex)

Minio/BucketRegionCache.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ internal static async Task<string> Update(IMinioClient client, string bucketName
100100
using var response =
101101
await client.ExecuteTaskAsync(client.ResponseErrorHandlers, requestBuilder).ConfigureAwait(false);
102102

103-
if (response is not null && HttpStatusCode.OK.Equals(response.StatusCode))
103+
if (response is not null && HttpStatusCode.OK == response.StatusCode)
104104
{
105105
var root = XDocument.Parse(response.Content);
106106
location = root.Root.Value;

Minio/Credentials/AssumeRoleBaseProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ internal virtual async Task<HttpRequestMessageBuilder> BuildRequest()
142142
internal virtual AccessCredentials ParseResponse(HttpResponseMessage response)
143143
{
144144
var content = Convert.ToString(response.Content, CultureInfo.InvariantCulture);
145-
if (string.IsNullOrEmpty(content) || !HttpStatusCode.OK.Equals(response.StatusCode))
145+
if (string.IsNullOrEmpty(content) || HttpStatusCode.OK != response.StatusCode)
146146
throw new ArgumentNullException(nameof(response), "Unable to generate credentials. Response error.");
147147

148148
using var stream = Encoding.UTF8.GetBytes(content).AsMemory().AsStream();

Minio/Credentials/IAMAWSProvider.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ public async Task<AccessCredentials> GetAccessCredentials(Uri url)
155155
await Client.ExecuteTaskAsync(Enumerable.Empty<IApiResponseErrorHandler>(), requestBuilder)
156156
.ConfigureAwait(false);
157157
if (string.IsNullOrWhiteSpace(response.Content) ||
158-
!HttpStatusCode.OK.Equals(response.StatusCode))
158+
HttpStatusCode.OK != response.StatusCode)
159159
throw new CredentialsProviderException("IAMAWSProvider",
160160
"Credential Get operation failed with HTTP Status code: " + response.StatusCode);
161161
/*
@@ -187,7 +187,7 @@ await Client.ExecuteTaskAsync(Enumerable.Empty<IApiResponseErrorHandler>(), requ
187187
.ConfigureAwait(false);
188188

189189
if (string.IsNullOrWhiteSpace(response.Content) ||
190-
!HttpStatusCode.OK.Equals(response.StatusCode))
190+
HttpStatusCode.OK != response.StatusCode)
191191
throw new CredentialsProviderException("IAMAWSProvider",
192192
"Credential Get operation failed with HTTP Status code: " + response.StatusCode);
193193

Minio/Credentials/WebIdentityClientGrantsProvider.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ internal override AccessCredentials ParseResponse(HttpResponseMessage response)
6565
// txtBlock.Text = readStream.ReadToEnd();
6666
var content = Convert.ToString(response.Content, CultureInfo.InvariantCulture);
6767
if (string.IsNullOrWhiteSpace(content) ||
68-
!HttpStatusCode.OK.Equals(response.StatusCode))
68+
HttpStatusCode.OK != response.StatusCode)
6969
throw new ArgumentNullException(nameof(response), "Unable to get credentials. Response error.");
7070

7171
using var stream = Encoding.UTF8.GetBytes(content).AsMemory().AsStream();

Minio/DataModel/Response/GetBucketEncryptionResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ internal class GetBucketEncryptionResponse : GenericResponse
2727
internal GetBucketEncryptionResponse(HttpStatusCode statusCode, string responseContent)
2828
: base(statusCode, responseContent)
2929
{
30-
if (string.IsNullOrEmpty(responseContent) || !HttpStatusCode.OK.Equals(statusCode))
30+
if (string.IsNullOrEmpty(responseContent) || HttpStatusCode.OK != statusCode)
3131
{
3232
BucketEncryptionConfiguration = null;
3333
return;

Minio/DataModel/Response/GetBucketLifecycleResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal GetBucketLifecycleResponse(HttpStatusCode statusCode, string responseCo
2828
: base(statusCode, responseContent)
2929
{
3030
if (string.IsNullOrEmpty(responseContent) ||
31-
!HttpStatusCode.OK.Equals(statusCode))
31+
HttpStatusCode.OK != statusCode)
3232
{
3333
BucketLifecycle = null;
3434
return;

Minio/DataModel/Response/GetBucketNotificationsResponse.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ internal GetBucketNotificationsResponse(HttpStatusCode statusCode, string respon
2828
: base(statusCode, responseContent)
2929
{
3030
if (string.IsNullOrEmpty(responseContent) ||
31-
!HttpStatusCode.OK.Equals(statusCode))
31+
HttpStatusCode.OK != statusCode)
3232
{
3333
BucketNotificationConfiguration = new BucketNotification();
3434
return;

0 commit comments

Comments
 (0)