Skip to content

Commit

Permalink
fix: remove query string from server URL (#895)
Browse files Browse the repository at this point in the history
  • Loading branch information
antograssiot authored and RomanHotsiy committed May 12, 2019
1 parent 5c91590 commit 64453ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/components/Endpoint/Endpoint.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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>
Expand Down
6 changes: 6 additions & 0 deletions src/utils/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

0 comments on commit 64453ff

Please sign in to comment.