{authorId:int} instead of {authorId} (#2822)
// its better to use {authorId:int} instead of just {authorId} // wrong {authorId} will produce a 400 error with error message // wrong {authorId:int} will produce a 404 error Since the publish date route is limited to a couple of formats, I assume you're of the type to prefer to control what type of error is shown to the resource user.pull/2801/merge
parent
da607bb672
commit
a47db5277c
|
@ -1,4 +1,4 @@
|
||||||
[Route("~api/authors/{authorId}/books")]
|
[Route("~/api/authors/{authorId:int}/books")]
|
||||||
public IQueryable<BookDto> GetBooksByAuthor(int authorId)
|
public IQueryable<BookDto> GetBooksByAuthor(int authorId)
|
||||||
{
|
{
|
||||||
return db.Books.Include(b => b.Author)
|
return db.Books.Include(b => b.Author)
|
||||||
|
|
Loading…
Reference in New Issue