mirror of
https://github.com/Redocly/redoc.git
synced 2024-11-23 00:56:33 +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 { OptionsContext } from '../OptionsProvider';
|
||||||
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
|
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
|
||||||
|
|
||||||
import { getBasePath } from '../../utils';
|
import {getBasePath, removeQueryString} from '../../utils';
|
||||||
import {
|
import {
|
||||||
EndpointInfo,
|
EndpointInfo,
|
||||||
HttpVerb,
|
HttpVerb,
|
||||||
|
@ -68,7 +68,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
|
||||||
<span>
|
<span>
|
||||||
{hideHostname || options.hideHostname
|
{hideHostname || options.hideHostname
|
||||||
? getBasePath(server.url)
|
? getBasePath(server.url)
|
||||||
: server.url}
|
: removeQueryString(server.url)}
|
||||||
</span>
|
</span>
|
||||||
{operation.path}
|
{operation.path}
|
||||||
</ServerUrl>
|
</ServerUrl>
|
||||||
|
|
|
@ -165,3 +165,9 @@ export function resolveUrl(url: string, to: string) {
|
||||||
export function getBasePath(serverUrl: string): string {
|
export function getBasePath(serverUrl: string): string {
|
||||||
return new URL(serverUrl).pathname;
|
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