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 3
3
// See the LICENSE file in the project root for more information.
4
4
5
5
using CommunityToolkit . Datasync . Client . Offline . Models ;
6
+ using System . Net ;
6
7
using System . Net . Http . Headers ;
7
8
8
9
namespace CommunityToolkit . Datasync . Client . Offline . Operations ;
@@ -29,6 +30,16 @@ internal override async Task<ServiceResponse> ExecuteAsync(EntityDatasyncOptions
29
30
}
30
31
31
32
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 ;
33
44
}
34
45
}
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ internal ServiceResponse(ServiceResponse response)
84
84
/// <summary>
85
85
/// The HTTP status code for this response.
86
86
/// </summary>
87
- public int StatusCode { get ; }
87
+ public int StatusCode { get ; internal set ; }
88
88
89
89
/// <summary>
90
90
/// 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