Skip to content

Commit 2e2f9bd

Browse files
committed
remove trailing slash
1 parent 00bc327 commit 2e2f9bd

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/Generator/Spec/OpenAPI.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ protected function buildDeclaration(Paths $paths, DefinitionsInterface $definiti
127127
$info->setVersion($this->apiVersion);
128128

129129
$server = new Server();
130-
$server->setUrl($baseUrl);
130+
if (!empty($baseUrl)) {
131+
$server->setUrl(rtrim($baseUrl, '/'));
132+
}
131133

132134
$result = $this->generator->toArray($definitions, null);
133135

src/Generator/Spec/TypeAPI.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public function generate(SpecificationInterface $specification): Generator\Code\
5555

5656
$baseUrl = $this->getBaseUrl($specification);
5757
if (!empty($baseUrl)) {
58-
$data['baseUrl'] = $baseUrl;
58+
$data['baseUrl'] = rtrim($baseUrl, '/');
5959
}
6060

6161
$security = $this->getSecurity($specification);

tests/Console/resource/spec_openapi.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
},
77
"servers": [
88
{
9-
"url": "http://foo.com/"
9+
"url": "http://foo.com"
1010
}
1111
],
1212
"paths": {

0 commit comments

Comments
 (0)