Alister West

home is where your code is ...

Mojo::Client - User-Agent header

(Reminder: Add comment to Mojolicious repo about this so easier for others)

I wanted to add a User-Agent header to from a random controller and it took too long to track down what is incredibly simple.

# Load config into stash (should use rel_file)
my $cfg = $self->plugin( json_config => {file => 'myapp.conf'} );

# ... some random controller that fetches info from somewhere else
my $client = Mojo::Client->new();
my $body = Mojo::Client->new->get( 
                    'User-Agent' => $self->stash('config')->{user_agent},
                    # ... more headers
By Alister West