File tree Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Expand file tree Collapse file tree 2 files changed +13
-2
lines changed Original file line number Diff line number Diff line change 33// See the LICENSE file in the project root for more information.
44
55using CommunityToolkit . Datasync . Client . Offline . Models ;
6+ using System . Net ;
67using System . Net . Http . Headers ;
78
89namespace CommunityToolkit . Datasync . Client . Offline . Operations ;
@@ -29,6 +30,16 @@ internal override async Task<ServiceResponse> ExecuteAsync(EntityDatasyncOptions
2930 }
3031
3132 using HttpResponseMessage response = await options . HttpClient . SendAsync ( request , cancellationToken ) . ConfigureAwait ( false ) ;
32- return new ServiceResponse ( response ) ;
33+ ServiceResponse serviceResponse = new ( response ) ;
34+
35+ // #397 - if the response is 404 (Not Found) or 410 (Gone), we return a successful response
36+ // since the item was deleted on the server.
37+ if ( response . StatusCode is HttpStatusCode . NotFound or HttpStatusCode . Gone )
38+ {
39+ // Convert the response to a successful response
40+ serviceResponse . StatusCode = ( int ) HttpStatusCode . NoContent ;
41+ }
42+
43+ return serviceResponse ;
3344 }
3445}
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ internal ServiceResponse(ServiceResponse response)
8484 /// <summary>
8585 /// The HTTP status code for this response.
8686 /// </summary>
87- public int StatusCode { get ; }
87+ public int StatusCode { get ; internal set ; }
8888
8989 /// <summary>
9090 /// Tries to get a header returned by the response; returns true if the header exists and false otherwise.
You can’t perform that action at this time.
0 commit comments