Replicate what aaronpk does in his endpoint
This commit is contained in:
parent
7fcbfec105
commit
95bf302dcd
2 changed files with 3 additions and 2 deletions
|
@ -58,7 +58,7 @@ class MicropubMediaController extends Controller
|
||||||
try {
|
try {
|
||||||
$media = Media::latest()->whereDate('created_at', '>=', Carbon::now()->subMinutes(30))->firstOrFail();
|
$media = Media::latest()->whereDate('created_at', '>=', Carbon::now()->subMinutes(30))->firstOrFail();
|
||||||
} catch (ModelNotFoundException $exception) {
|
} catch (ModelNotFoundException $exception) {
|
||||||
return response()->json([], 404);
|
return response()->json(['url' => null]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response()->json(['url' => $media->url]);
|
return response()->json(['url' => $media->url]);
|
||||||
|
|
|
@ -28,7 +28,8 @@ class MicropubMediaTest extends TestCase
|
||||||
'/api/media?q=last',
|
'/api/media?q=last',
|
||||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||||
);
|
);
|
||||||
$response->assertStatus(404);
|
$response->assertStatus(200);
|
||||||
|
$response->assertJson(['url' => null]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** @test */
|
/** @test */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue