Skip to content

Commit 105c6f4

Browse files
committed
[Notifier] [Free Mobile] Could not use custom host in DSN
1 parent 3a3b249 commit 105c6f4

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransport.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
*/
2727
final class FreeMobileTransport extends AbstractTransport
2828
{
29-
protected const HOST = 'https://smsapi.free-mobile.fr/sendmsg';
29+
protected const HOST = 'smsapi.free-mobile.fr/sendmsg';
3030

3131
private $login;
3232
private $password;

src/Symfony/Component/Notifier/Bridge/FreeMobile/FreeMobileTransportFactory.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ public function create(Dsn $dsn): TransportInterface
4343
throw new IncompleteDsnException('Missing phone.', $dsn->getOriginalDsn());
4444
}
4545

46-
return new FreeMobileTransport($login, $password, $phone, $this->client, $this->dispatcher);
46+
$host = 'default' === $dsn->getHost() ? null : $dsn->getHost();
47+
$port = $dsn->getPort();
48+
49+
return (new FreeMobileTransport($login, $password, $phone, $this->client, $this->dispatcher))->setHost($host)->setPort($port);
4750
}
4851

4952
protected function getSupportedSchemes(): array

src/Symfony/Component/Notifier/Bridge/FreeMobile/Tests/FreeMobileTransportFactoryTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,7 @@ public function testCreateWithDsn()
2323
{
2424
$factory = $this->createFactory();
2525

26-
$dsn = 'freemobile://login:pass@default?phone=0611223344';
27-
$transport = $factory->create(Dsn::fromString($dsn));
28-
$transport->setHost('host.test');
26+
$transport = $factory->create(Dsn::fromString('freemobile://login:pass@host.test?phone=0611223344'));
2927

3028
$this->assertSame('freemobile://host.test?phone=0611223344', (string) $transport);
3129
}

0 commit comments

Comments
 (0)