( pathname: string, params: URLSearchParams | string, )
| 138 | }; |
| 139 | |
| 140 | export const getPathnameWithQuery = ( |
| 141 | pathname: string, |
| 142 | params: URLSearchParams | string, |
| 143 | ): string => { |
| 144 | const [basePath, existingQuery] = pathname.split('?'); |
| 145 | const merged = new URLSearchParams(existingQuery?.trim()); |
| 146 | const overrides = new URLSearchParams(params); |
| 147 | overrides.forEach((value, key) => { |
| 148 | merged.set(key, value); |
| 149 | }); |
| 150 | const queryString = merged.toString(); |
| 151 | |
| 152 | return `${basePath}${queryString ? `?${queryString}` : ''}`; |
| 153 | }; |
| 154 | |
| 155 | // For hrefs that must reach the webapp whoever renders them: on the extension |
| 156 | // a root-relative path resolves against `chrome-extension://<id>` and 404s. |
no outgoing calls
no test coverage detected