Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// See the LICENSE file in the project root for more information.

using CommunityToolkit.Datasync.Client.Offline.Models;
using System.Net;
using System.Net.Http.Headers;

namespace CommunityToolkit.Datasync.Client.Offline.Operations;
Expand All @@ -29,6 +30,16 @@ internal override async Task<ServiceResponse> ExecuteAsync(EntityDatasyncOptions
}

using HttpResponseMessage response = await options.HttpClient.SendAsync(request, cancellationToken).ConfigureAwait(false);
return new ServiceResponse(response);
ServiceResponse serviceResponse = new(response);

// #397 - if the response is 404 (Not Found) or 410 (Gone), we return a successful response
// since the item was deleted on the server.
if (response.StatusCode is HttpStatusCode.NotFound or HttpStatusCode.Gone)
{
// Convert the response to a successful response
serviceResponse.StatusCode = (int)HttpStatusCode.NoContent;
}

return serviceResponse;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ internal ServiceResponse(ServiceResponse response)
/// <summary>
/// The HTTP status code for this response.
/// </summary>
public int StatusCode { get; }
public int StatusCode { get; internal set; }

/// <summary>
/// Tries to get a header returned by the response; returns true if the header exists and false otherwise.
Expand Down
Loading