How does superdeno intercept redirects?
See original GitHub issueIs there a way to test for redirects?
When I do something along the lines of:
await superdeno(testApiUrl)
.post('/api/to/endpoint/that/triggers/a/redirect')
.expect((response, error) => {
assertEquals(response.status, 302);
assertEquals(response.headers.includes('location: http://google.com/'), true);
});
This errors out and insists that the final state is 200, not 302.
I’ve noticed that the response.headers capture those of the final destination page rather than the actual API redirect state. Is there a way to go one step before the final destination URL?
I have also tried
await superdeno(testApiUrl)
.post('/api/to/endpoint/that/triggers/a/redirect')
.expect(302)
.expect((response, error) => {
assertEquals(response.headers.includes('location: http://google.com/'), true);
});
but to no effect.
Thanks heaps (again great library).
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (2 by maintainers)
Top Results From Across the Web
/test/redirects.test.ts | superdeno@4.2.1 | Deno
import * as superdeno from "https://deno.land/x/superdeno@4.2.1/test/redirects.test.ts";. The documentation for this module is currently unavailable.
Read more >Deno nuggets: Redirect a request - Medium
The redirect function is a static function that takes an absolute URL, along with an optional status code. A Response object is returned....
Read more >How to Intercept express redirect request - Stack Overflow
I have a use case where I want to redirect the client requests to https://ifconfig.co/json to get some info, but before I send...
Read more >DNS port intercept redirect to multiple internal DNS servers
I am using the following firewall rules to intercept all DNS queries and redirect to my local pi-hole ( 10.1.1.2 ) server.
Read more >Node.js Tips — Testing Redirects, Sessions, and Auth ...
To test requests that redirect to another route with Supertest running in ... We can add a middleware to a route to check...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Awesome, this works brilliantly. Thanks a lot for the effort!
@avihavai, @viztastic support for a
.redirects(n)
API (as per superagent and supertest) has been released in3.0.0
.I hope this helps with any missing test coverage you might have! Please raise new issues if you have any problems with it 🙃