diff --git a/src/components/Endpoint/Endpoint.tsx b/src/components/Endpoint/Endpoint.tsx index 734fa32b49..08e7f7b775 100644 --- a/src/components/Endpoint/Endpoint.tsx +++ b/src/components/Endpoint/Endpoint.tsx @@ -4,6 +4,7 @@ import { OperationModel } from '../../services'; import { OptionsContext } from '../OptionsProvider'; import { SelectOnClick } from '../SelectOnClick/SelectOnClick'; +import { getBasePath } from '../../utils'; import { EndpointInfo, HttpVerb, @@ -63,7 +64,11 @@ export class Endpoint extends React.Component {
{server.description}
- {!(hideHostname || options.hideHostname) && {server.url}} + + {hideHostname || options.hideHostname + ? getBasePath(server.url) + : server.url} + {operation.path} diff --git a/src/utils/helpers.ts b/src/utils/helpers.ts index 116390633d..699d3da523 100644 --- a/src/utils/helpers.ts +++ b/src/utils/helpers.ts @@ -161,3 +161,7 @@ export function resolveUrl(url: string, to: string) { } return stripTrailingSlash(res); } + +export function getBasePath(serverUrl: string): string { + return new URL(serverUrl).pathname; +}