Skip to content

Commit 64453ff

Browse files
antograssiotRomanHotsiy
authored andcommitted
fix: remove query string from server URL (#895)
1 parent 5c91590 commit 64453ff

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/components/Endpoint/Endpoint.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Markdown } from '../Markdown/Markdown';
55
import { OptionsContext } from '../OptionsProvider';
66
import { SelectOnClick } from '../SelectOnClick/SelectOnClick';
77

8-
import { getBasePath } from '../../utils';
8+
import {getBasePath, removeQueryString} from '../../utils';
99
import {
1010
EndpointInfo,
1111
HttpVerb,
@@ -68,7 +68,7 @@ export class Endpoint extends React.Component<EndpointProps, EndpointState> {
6868
<span>
6969
{hideHostname || options.hideHostname
7070
? getBasePath(server.url)
71-
: server.url}
71+
: removeQueryString(server.url)}
7272
</span>
7373
{operation.path}
7474
</ServerUrl>

src/utils/helpers.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,3 +165,9 @@ export function resolveUrl(url: string, to: string) {
165165
export function getBasePath(serverUrl: string): string {
166166
return new URL(serverUrl).pathname;
167167
}
168+
169+
export function removeQueryString(serverUrl: string): string {
170+
const url = new URL(serverUrl);
171+
url.search = '';
172+
return url.toString();
173+
}

0 commit comments

Comments
 (0)