http_status_code.cc revision eb525c5499e34cc9c4b825d6d9e75bb07cc06ace
1868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved.
2868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be
3868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)// found in the LICENSE file.
4868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
5868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "net/http/http_status_code.h"
6868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
7868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "base/logging.h"
8868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
9868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)namespace net {
10868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
11868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)const char* GetHttpReasonPhrase(HttpStatusCode code) {
12868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  switch (code) {
13868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
14868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#define HTTP_STATUS(label, code, reason) case HTTP_ ## label: return reason;
15868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#include "net/http/http_status_code_list.h"
16868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)#undef HTTP_STATUS
17868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
18868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)    default:
19eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch      NOTREACHED() << "unknown HTTP status code " << code;
20868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  }
21868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
22868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)  return "";
23868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}
24868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)
25868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles)}  // namespace net
26