mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-07-23 00:04:03 -04:00
POST requests create a new entity and should result in a 201 Created
reply with a Location field that matches the URL of the newly created resource. Fixes ticket #1178.
This commit is contained in:
@@ -81,6 +81,11 @@ 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
|
||||
|
||||
Reference in New Issue
Block a user