diff options
author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
---|---|---|
committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-08-06 21:36:32 +0000 |
commit | 691ce806dc9aefac596a692ff2ba927a81a65440 (patch) | |
tree | 410f64288ef1d8bbc8455509af74d0e7582dc48e /modules/rest/controllers/rest.php | |
parent | c83650d83ad8b1f4bda30cac2ae8efa6e1c97287 (diff) | |
parent | 8559cdb5b6bfa87864941f726521660023779fa7 (diff) |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'modules/rest/controllers/rest.php')
-rw-r--r-- | modules/rest/controllers/rest.php | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/rest/controllers/rest.php b/modules/rest/controllers/rest.php index f8a46515..bf2f0a54 100644 --- a/modules/rest/controllers/rest.php +++ b/modules/rest/controllers/rest.php @@ -81,12 +81,19 @@ class Rest_Controller extends Controller { } $response = call_user_func(array($handler_class, $handler_method), $request); + if ($handler_method == "post") { + // post methods must return a response containing a URI. + header("HTTP/1.1 201 Created"); + header("Location: {$response['url']}"); + } rest::reply($response); } catch (ORM_Validation_Exception $e) { // Note: this is totally insufficient because it doesn't take into account localization. We // either need to map the result values to localized strings in the application code, or every // client needs its own l10n string set. throw new Rest_Exception("Bad Request", 400, $e->validation->errors()); + } catch (Kohana_404_Exception $e) { + throw new Rest_Exception("Not Found", 404); } } }
\ No newline at end of file |