mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-11 11:26:37 +03:00
fix: remove query string from server URL (#895)
This commit is contained in:
parent
5c915906c8
commit
64453ff6cd
|
@ -5,7 +5,7 @@ import { Markdown } from '../Markdown/Markdown';
|
|||
import { OptionsContext } from '../OptionsProvider';
|
||||
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
|
||||
|
||||
import { getBasePath } from '../../utils';
|
||||
import {getBasePath, removeQueryString} from '../../utils';
|
||||
import {
|
||||
EndpointInfo,
|
||||
HttpVerb,
|
||||
|
@ -68,7 +68,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
|
|||
<span>
|
||||
{hideHostname || options.hideHostname
|
||||
? getBasePath(server.url)
|
||||
: server.url}
|
||||
: removeQueryString(server.url)}
|
||||
</span>
|
||||
{operation.path}
|
||||
</ServerUrl>
|
||||
|
|
|
@ -165,3 +165,9 @@ export function resolveUrl(url: string, to: string) {
|
|||
export function getBasePath(serverUrl: string): string {
|
||||
return new URL(serverUrl).pathname;
|
||||
}
|
||||
|
||||
export function removeQueryString(serverUrl: string): string {
|
||||
const url = new URL(serverUrl);
|
||||
url.search = '';
|
||||
return url.toString();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user