We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Describe the bug When you want to access the final location after redirection the location is set to initial while browser exposes the final location.
To Reproduce
npm i msw happy-dom
import { http, HttpResponse } from 'msw'; import { setupServer } from 'msw/node'; import { deepEqual, strictEqual } from 'node:assert'; import { Browser } from 'happy-dom'; const handlers = [ http.get('https://example.com/user', () => { return HttpResponse.redirect('https://example.com/auth'); }), http.get('https://example.com/auth', () => { return HttpResponse.html('AUTH PAGE'); }), http.get('*', (req) => { throw new Error('Not mocked yet' + req.request.url); }) ]; const server = setupServer(...handlers); server.listen(); const result = await fetch('https://example.com/user').then(async (res) => { return { status: res.status, content: res.headers.get('content-type')?.includes('json') ? await res.json() : await res.text() }; }); // Ensure MSW redirected content properly while fetch deepEqual(result, { status: 200, content: 'AUTH PAGE' }); const browser = new Browser(); const page = browser.newPage(); await page.goto('https://example.com/user'); strictEqual(page.content, '<html><head></head><body>AUTH PAGE</body></html>'); strictEqual(page.mainFrame.window.location.href, 'https://example.com/auth'); // ^ AssertionError [ERR_ASSERTION]: Expected values to be strictly equal: // + actual - expected // + 'https://example.com/user' // - 'https://example.com/auth'
Expected behavior this should pass
strictEqual(page.mainFrame.window.location.href, 'https://example.com/auth');
Screenshots If applicable, add screenshots to help explain your problem.
Device:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Describe the bug
When you want to access the final location after redirection the location is set to initial while browser exposes the final location.
To Reproduce
Expected behavior
this should pass
Screenshots
If applicable, add screenshots to help explain your problem.
Device:
Additional context
The text was updated successfully, but these errors were encountered: