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

Miscellaneous DPS service client cleanup #3264

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion provisioning/service/src/Http/ContractApiHttp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ private static async Task ValidateHttpResponse(HttpResponseMessage response)
try
{
string payload = await response.Content.ReadAsStringAsync();
ResponseBody responseBody = JsonConvert.DeserializeObject<ResponseBody>(payload);
ErrorResponse responseBody = JsonConvert.DeserializeObject<ErrorResponse>(payload);

if (response.StatusCode >= HttpStatusCode.Ambiguous)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
namespace Microsoft.Azure.Devices.Provisioning.Service
{
/// <summary>
/// A class used as a model to deserialize response body object received from DPS.
/// A class used as a model to deserialize response body object received from DPS in error cases.
/// </summary>
internal sealed class ResponseBody
internal sealed class ErrorResponse
{
[JsonProperty("errorCode")]
internal int ErrorCode { get; set; }
Comment on lines 10 to 11
Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, so this property is not for general "status code" (2XX) as well, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm, it's interesting that we have another property called "Code" and getting from this property.

Copy link
Member Author

Choose a reason for hiding this comment

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

This class is only used to deserialize the HTTP response in cases where the HTTP status is not 200 or 204, but I suspect this field is still the same value as the HTTP status code

Expand Down
2 changes: 0 additions & 2 deletions provisioning/service/src/Utilities/QueryBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@ namespace Microsoft.Azure.Devices.Provisioning.Service
internal class QueryBuilder
{
private const string ContinuationTokenHeaderKey = "x-ms-continuation";
private const string ItemTypeHeaderKey = "x-ms-item-type";
private const string PageSizeHeaderKey = "x-ms-max-item-count";
private const string QueryUriFormat = "{0}/query";

internal static async Task<Page<T>> BuildAndSendRequestAsync<T>(
ContractApiHttp contractApiHttp,
Expand Down