dotnet / AspNetCore.Docs

Documentation for ASP.NET Core
https://docs.microsoft.com/aspnet/core
Creative Commons Attribution 4.0 International
12.58k stars 25.29k forks source link

Incorrect Location Header in First Web API Tutorial #32917

Closed ajhanson22227 closed 2 months ago

ajhanson22227 commented 3 months ago

Description

https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-8.0&tabs=visual-studio-code#update-the-posttodoitem-create-method

In the code sample it replaces the hard-coded "PostTodoItem" action name using nameof; however, when created following this guide, it is generated with "GetTodoItem" instead and should probably use that in the example page. Using the GetTodoItem action returns the correct url path to get the record while using PostTodoItem action returns the id in a query string, and using that url as a GET request will call the GetAll action

Page URL

https://learn.microsoft.com/en-us/aspnet/core/tutorials/first-web-api?view=aspnetcore-8.0&tabs=visual-studio

Content source URL

https://github.com/dotnet/AspNetCore.Docs/blob/main/aspnetcore/tutorials/first-web-api.md

Document ID

95f2549e-29f9-e31a-b4d0-432b971643ff

Article author

@wadepickett


Associated WorkItem - 272935

wadepickett commented 3 months ago

@ajhanson22227, thanks for the suggestion and letting us know your experience with the topic. I will queue this up to look at it for improvement.

wadepickett commented 2 months ago

Verified return for PostTodoItem is using nameof(GetTodoItem) in current update.