Book Image

ServiceStack 4 Cookbook

Book Image

ServiceStack 4 Cookbook

Overview of this book

Table of Contents (18 chapters)
ServiceStack 4 Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Returning meaningful HTTP error messages


The HTTP specification has several standard HTTP error messages. The 1.0 draft of the Hypertext Transfer Protocol from 1996 established the notion of standardized response status codes. The 404 Not Found status code is perhaps the most famous, as web users have generally seen this at least once in their travels, even when websites return a friendly page when a 404 error is encountered.

The status codes have withstood the test of time and were included in the HTTP 1.1 draft that came out three years later in 1999, which continues to be the standard HTTP protocol today. HTTP 2.0, which will most likely replace it, is in only in draft form today.

One reason that it can be important to return status codes that are standardized and meaningful is that HTTP-aware networking equipment and web browsers can then make intelligent decisions about what to do when a response is encountered.

For instance, a network proxy might cache the content of a GET request that...