Modifying the Requirement for the Route Handlers With a Unit Test
Since we are now expecting JSON and XML responses if the respective headers are set, we should add tests to the handlers.article_test.go file to test these conditions. We will add tests to:
- Test that the application returns a JSON list of articles when the
Acceptheader is set toapplication/json - Test the the application returns an article in XML format when the
Acceptheader is set toapplication/xml
These will be added as functions named TestArticleListJSON and TestArticleXML.