fix: remove query string from server URL (#895)

This commit is contained in:
Anto 2019-05-12 21:10:49 +02:00 committed by Roman Hotsiy
parent 5c915906c8
commit 64453ff6cd
2 changed files with 8 additions and 2 deletions

View File

@ -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>

View File

@ -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();
}