fix: strip off hash from request urls (#297)
This commit is contained in:
parent
b5e9086576
commit
da051a72a8
|
|
@ -67,6 +67,15 @@ export function rewriteCookies(cookies: SetNetworkCookieParam[]): SetNetworkCook
|
|||
});
|
||||
}
|
||||
|
||||
function stripFragmentFromUrl(url: string): string
|
||||
{
|
||||
if (!url.indexOf('#'))
|
||||
return url;
|
||||
const parsed = new URL(url);
|
||||
parsed.hash = '';
|
||||
return parsed.href;
|
||||
}
|
||||
|
||||
export type Headers = { [key: string]: string };
|
||||
|
||||
export class Request {
|
||||
|
|
@ -94,7 +103,7 @@ export class Request {
|
|||
for (const request of redirectChain)
|
||||
request._finalRequest = this;
|
||||
this._documentId = documentId;
|
||||
this._url = url;
|
||||
this._url = stripFragmentFromUrl(url);
|
||||
this._resourceType = resourceType;
|
||||
this._method = method;
|
||||
this._postData = postData;
|
||||
|
|
|
|||
|
|
@ -390,7 +390,7 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
|
|||
expect(requests.length).toBe(1);
|
||||
expect(requests[0].url()).toBe(dataURL);
|
||||
});
|
||||
it.skip(FFOX || WEBKIT)('should navigate to URL with hash and fire requests without hash', async({page, server}) => {
|
||||
it('should navigate to URL with hash and fire requests without hash', async({page, server}) => {
|
||||
const requests = [];
|
||||
page.on('request', request => !utils.isFavicon(request) && requests.push(request));
|
||||
const response = await page.goto(server.EMPTY_PAGE + '#hash');
|
||||
|
|
|
|||
Loading…
Reference in a new issue