( pathname: string, params: URLSearchParams | string, )
| 118 | }; |
| 119 | |
| 120 | export const getPathnameWithQuery = ( |
| 121 | pathname: string, |
| 122 | params: URLSearchParams | string, |
| 123 | ): string => { |
| 124 | const [basePath, existingQuery] = pathname.split('?'); |
| 125 | const merged = new URLSearchParams(existingQuery?.trim()); |
| 126 | const overrides = new URLSearchParams(params); |
| 127 | overrides.forEach((value, key) => { |
| 128 | merged.set(key, value); |
| 129 | }); |
| 130 | const queryString = merged.toString(); |
| 131 | |
| 132 | return `${basePath}${queryString ? `?${queryString}` : ''}`; |
| 133 | }; |
| 134 | |
| 135 | // For hrefs that must reach the webapp whoever renders them: on the extension |
| 136 | // a root-relative path resolves against `chrome-extension://<id>` and 404s. |
no outgoing calls
no test coverage detected