Practicing and exploring
Test your knowledge and understanding by answering some questions, get some hands-on practice, and explore this chapter's topics with deeper research.
Exercise 16.1 – Test your knowledge
Answer the following questions:
- Which class should you inherit from to create a controller class for an ASP.NET Core Web API service?
- If you decorate your controller class with the
[ApiController]
attribute to get default behavior like automatic400
responses for invalid models, what else must you do? - What must you do to specify which controller action method will be executed in response to an HTTP request?
- What must you do to specify what responses should be expected when calling an action method?
- List three methods that can be called to return responses with different status codes.
- List four ways that you can test a web service.
- Why should you not wrap your use of
HttpClient
in ausing
statement to dispose...