diff options
author | John Christopher Anderson <jchris@apache.org> | 2009-02-08 20:29:51 +0000 |
---|---|---|
committer | John Christopher Anderson <jchris@apache.org> | 2009-02-08 20:29:51 +0000 |
commit | 58e040359fa8d175b9eecec49f58e3dd00c78d1e (patch) | |
tree | 7c218754dd33d91c570473fdb0355c8e43341072 /src/couchdb/couch_httpd.erl | |
parent | 85471cdf0cf6ec23529b07ec4382948a5e76af3f (diff) |
extract method couch_httpd:send_redirect(Req, Path)
git-svn-id: https://svn.apache.org/repos/asf/couchdb/trunk@742158 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'src/couchdb/couch_httpd.erl')
-rw-r--r-- | src/couchdb/couch_httpd.erl | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/couchdb/couch_httpd.erl b/src/couchdb/couch_httpd.erl index 56f651d8..767b91d4 100644 --- a/src/couchdb/couch_httpd.erl +++ b/src/couchdb/couch_httpd.erl @@ -21,7 +21,7 @@ -export([primary_header_value/2,partition/1,serve_file/3]). -export([start_chunked_response/3,send_chunk/2]). -export([start_json_response/2, start_json_response/3, end_json_response/1]). --export([send_response/4,send_method_not_allowed/2,send_error/4]). +-export([send_response/4,send_method_not_allowed/2,send_error/4, send_redirect/2]). -export([send_json/2,send_json/3,send_json/4]). -export([default_authentication_handler/1,special_test_authentication_handler/1]). @@ -424,7 +424,9 @@ send_error(Req, Code, Error, <<>>) -> send_error(Req, Code, Error, Msg) -> send_json(Req, Code, {[{<<"error">>, Error}, {<<"reason">>, Msg}]}). - +send_redirect(Req, Path) -> + Headers = [{"Location", couch_httpd:absolute_uri(Req, Path)}], + send_response(Req, 301, Headers, <<>>). negotiate_content_type(#httpd{mochi_req=MochiReq}) -> %% Determine the appropriate Content-Type header for a JSON response |