Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
How do I mock a request header when testing an app with Test::WWW::Mechanize?
My use case: I have a Catalyst app that, in one case, needs to grab a value from the hostname that's sending an API request. (Requests can come from something like forum_name.example.com and I need to extract "forum_name".)
How do I test this? When I use Test::WWW::Mechanize, all requests come from "localhost", but I need to try goodname.localhost to make sure that works, badname.localhost so I can reject an unconfigured name, etc.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Mocking request headers with Test::WWW::Mechanize?
by Corion (Patriarch) on Oct 25, 2021 at 14:10 UTC | |
by Anonymous Monk on Oct 25, 2021 at 14:37 UTC | |
|
Re: Mocking request headers with Test::WWW::Mechanize?
by perlfan (Parson) on Oct 25, 2021 at 15:26 UTC | |
by Anonymous Monk on Oct 25, 2021 at 15:31 UTC | |
by perlfan (Parson) on Oct 25, 2021 at 16:58 UTC |