fix: left trim url if there is a trailing slash (#5149)

This commit is contained in:
Alexis Saettler
2021-05-03 10:16:18 +02:00
committed by GitHub
parent 873a8d7e5f
commit 56572bbd57
5 changed files with 8 additions and 5 deletions
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Api\Auth;
use App\Models\User\User;
use Illuminate\Support\Str;
use Illuminate\Http\Request;
use function Safe\json_decode;
use Illuminate\Http\JsonResponse;
@@ -190,7 +191,7 @@ class OAuthController extends Controller
*/
private function proxy(array $data = []): array
{
$url = App::runningUnitTests() ? config('app.url').'/oauth/token' : route('passport.token');
$url = App::runningUnitTests() ? Str::of(config('app.url'))->ltrim('/').'/oauth/token' : route('passport.token');
/** @var \Illuminate\Http\Response */
$response = app(Kernel::class)->handle(Request::create($url, 'POST', [
'grant_type' => $data['grantType'],