Debug via log
This commit is contained in:
parent
07ad894b66
commit
a632a8e2da
2 changed files with 5 additions and 2 deletions
|
@ -54,6 +54,7 @@ class MicropubClientController extends Controller
|
||||||
*/
|
*/
|
||||||
public function store(Request $request)
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
|
Log::info('posting new note');
|
||||||
$domain = $request->session()->get('me');
|
$domain = $request->session()->get('me');
|
||||||
$token = $request->session()->get('token');
|
$token = $request->session()->get('token');
|
||||||
|
|
||||||
|
@ -62,12 +63,14 @@ class MicropubClientController extends Controller
|
||||||
$this->indieClient
|
$this->indieClient
|
||||||
);
|
);
|
||||||
if (! $micropubEndpoint) {
|
if (! $micropubEndpoint) {
|
||||||
|
Log::error('no known endpoint to post to');
|
||||||
return redirect(route('micropub-client'))->withErrors('Unable to determine micropub API endpoint', 'endpoint');
|
return redirect(route('micropub-client'))->withErrors('Unable to determine micropub API endpoint', 'endpoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
$response = $this->postNoteRequest($request, $micropubEndpoint, $token);
|
$response = $this->postNoteRequest($request, $micropubEndpoint, $token);
|
||||||
|
|
||||||
if ($response->getStatusCode() == 201) {
|
if ($response->getStatusCode() == 201) {
|
||||||
|
Log::info('redirecting to note');
|
||||||
$location = $response->getHeader('Location');
|
$location = $response->getHeader('Location');
|
||||||
if (is_array($location)) {
|
if (is_array($location)) {
|
||||||
return redirect($location[0]);
|
return redirect($location[0]);
|
||||||
|
@ -75,7 +78,7 @@ class MicropubClientController extends Controller
|
||||||
|
|
||||||
return redirect($location);
|
return redirect($location);
|
||||||
}
|
}
|
||||||
|
Log::error('note not created');
|
||||||
return redirect(route('micropub-client'))->withErrors('Endpoint didn’t create the note.', 'endpoint');
|
return redirect(route('micropub-client'))->withErrors('Endpoint didn’t create the note.', 'endpoint');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@ class MicropubClientTest extends DuskTestCase
|
||||||
$faker = \Faker\Factory::create();
|
$faker = \Faker\Factory::create();
|
||||||
$note = $faker->text;
|
$note = $faker->text;
|
||||||
$this->browse(function ($browser) use ($note) {
|
$this->browse(function ($browser) use ($note) {
|
||||||
$browser->visit('/micropub/create')
|
$browser->visit(route('micropub-client'))
|
||||||
->type('textarea[name="content"]', $note)
|
->type('textarea[name="content"]', $note)
|
||||||
->press('submit');
|
->press('submit');
|
||||||
sleep(2);
|
sleep(2);
|
||||||
|
|
Loading…
Add table
Reference in a new issue