Skip to content

Commit d82db99

Browse files
authored
Merge pull request #48 from medokin/master
Use 204 on empty delete response
2 parents e52c2a8 + 00c4ee8 commit d82db99

File tree

3 files changed

+2
-7
lines changed

3 files changed

+2
-7
lines changed

src/JsonApiDotNetCore/Controllers/JsonApiController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,7 @@ public virtual async Task<IActionResult> DeleteAsync(TId id)
201201
if (!wasDeleted)
202202
return NotFound();
203203

204-
return Ok();
204+
return NoContent();
205205
}
206206

207207
private IQueryable<T> ApplySortAndFilterQuery(IQueryable<T> entities)

test/JsonApiDotNetCoreExampleTests/Acceptance/Spec/DeletingDataTests.cs

-5
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
using System.Collections.Generic;
21
using System.Linq;
32
using System.Net;
43
using System.Net.Http;
5-
using System.Net.Http.Headers;
64
using System.Threading.Tasks;
75
using Bogus;
86
using DotNetCoreDocs;
97
using DotNetCoreDocs.Writers;
10-
using JsonApiDotNetCore.Serialization;
11-
using JsonApiDotNetCore.Services;
128
using JsonApiDotNetCoreExample;
139
using JsonApiDotNetCoreExample.Data;
1410
using JsonApiDotNetCoreExample.Models;
1511
using Microsoft.AspNetCore.Hosting;
1612
using Microsoft.AspNetCore.TestHost;
17-
using Newtonsoft.Json;
1813
using Xunit;
1914

2015
namespace JsonApiDotNetCoreExampleTests.Acceptance.Spec

test/JsonApiDotNetCoreExampleTests/Acceptance/TodoItemsControllerTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ public async Task Can_Delete_TodoItem()
424424
var response = await _fixture.MakeRequest<TodoItem>(description, request);
425425

426426
// Assert
427-
Assert.Equal(HttpStatusCode.OK, response.StatusCode);
427+
Assert.Equal(HttpStatusCode.NoContent, response.StatusCode);
428428
Assert.Null(_context.TodoItems.FirstOrDefault(t => t.Id == todoItem.Id));
429429
}
430430
}

0 commit comments

Comments
 (0)