Allow JSON requests to the micropub endpoint

This commit is contained in:
Jonny Barnes 2016-07-11 17:09:14 +01:00
parent 50126828ff
commit 72e61032d8
4 changed files with 21 additions and 7 deletions

View file

@ -56,8 +56,7 @@ class MicropubController extends Controller
$scopes = explode(' ', $tokenData->getClaim('scope'));
if (array_search('post', $scopes) !== false) {
$clientId = $tokenData->getClaim('client_id');
$type = $request->input('h');
if ($type == 'entry') {
if (($request->input('h') == 'entry') || ($request->input('type')[0] == 'h-entry')) {
$note = $this->noteService->createNote($request, $clientId);
$content = <<<EOD
{
@ -70,7 +69,7 @@ EOD;
->header('Location', $note->longurl)
->header('Content-Type', 'application/json');
}
if ($type == 'card') {
if ($request->input('h') == 'card' || $request->input('type')[0] == 'h-card') {
$place = $this->placeService->createPlace($request);
$content = <<<EOD
{