Http::response('{"ok":true}', 200, [ 'Content-Type' => 'application/json', ]), ]); // Trailing-dot FQDN: normalizes to pixelfed.org, same origin as the hop. $body = SecureMediaFetchService::get('https://pixelfed.org./story', null, null, [ 'Authorization' => 'Bearer secret-token', ]); expect($body)->toBe('{"ok":true}'); Http::assertSent(function ($request) { return $request->url() === 'https://pixelfed.org/story' && $request->hasHeader('Authorization', 'Bearer secret-token'); }); }); it('forwards caller headers when the input host case differs', function () { seedPublicIpForOrigin('pixelfed.org'); Http::fake([ 'https://pixelfed.org/story' => Http::response('{"ok":true}', 200, [ 'Content-Type' => 'application/json', ]), ]); $body = SecureMediaFetchService::get('https://PixelFed.ORG/story', null, null, [ 'Authorization' => 'Bearer secret-token', ]); expect($body)->toBe('{"ok":true}'); Http::assertSent(function ($request) { return $request->url() === 'https://pixelfed.org/story' && $request->hasHeader('Authorization', 'Bearer secret-token'); }); }); it('still strips caller headers on a genuine cross-origin redirect', function () { seedPublicIpForOrigin('pixelfed.org'); seedPublicIpForOrigin('joinloops.org'); Http::fake([ 'https://pixelfed.org/story' => Http::response('', 302, [ 'Location' => 'https://joinloops.org/story', ]), 'https://joinloops.org/story' => Http::response('{"ok":true}', 200, [ 'Content-Type' => 'application/json', ]), ]); $body = SecureMediaFetchService::get('https://pixelfed.org./story', null, null, [ 'Authorization' => 'Bearer secret-token', ]); expect($body)->toBe('{"ok":true}'); Http::assertSent(function ($request) { if ($request->url() !== 'https://joinloops.org/story') { return false; } return ! $request->hasHeader('Authorization'); }); });