redirectChain property
A redirectChain
is a chain of requests initiated to fetch a resource.
- If there are no redirects and the request was successful, the chain will be empty.
- If a server responds with at least a single redirect, then the chain will contain all the requests that were redirected.
redirectChain
is shared between all the requests of the same chain.
For example, if the website http://example.com
has a single redirect to
https://example.com
, then the chain will contain one request:
var response = await page.goto('http://example.com');
var chain = response.request.redirectChain;
expect(chain, hasLength(1));
expect(chain[0].url, 'http://example.com');
If the website https://example.com
has no redirects, then the chain will
be empty:
var response = await page.goto('https://example.com');
var chain = response.request.redirectChain;
expect(chain, isEmpty);
Implementation
final List<Request> redirectChain;