customUserAgent field of RedditOptions is never used
Closed this issue · 0 comments
akhra commented
This is just from reading source, so correct me if I've missed something. Ultimately every runReddit
variant ends up at runResumeRedditWith
:
runReddit user pass = runRedditWith def { loginMethod = Credentials user pass }
runRedditAnon = runRedditWith def
runRedditWith opts reddit = liftM dropResume $ runResumeRedditWith opts reddit
And runResumeRedditWith
unpacks customUserAgent
into _ua
, which is discarded:
runResumeRedditWith :: MonadIO m => RedditOptions -> RedditT m a -> m (Either (APIError RedditError, Maybe (RedditT m a)) a)
runResumeRedditWith (RedditOptions rl man lm _ua) reddit = do
manager <- case man of
Just m -> return m
Nothing -> liftIO $ newManager tlsManagerSettings
loginCreds <- case lm of
Anonymous -> return $ Right Nothing
StoredDetails ld -> return $ Right $ Just ld
Credentials user pass -> liftM (fmap Just) $ interpretIO (RedditState loginBaseURL rl manager [] Nothing) $ login user pass
case loginCreds of
Left (err, _) -> return $ Left (err, Just reddit)
Right lds ->
interpretIO
(RedditState mainBaseURL rl manager [("User-Agent", "reddit-haskell dev version")] lds) reddit
In fact, even if the supplied Manager
has a custom UA, it looks like it's overridden for everything except the login action. Everything else gets the hard-coded UA "reddit-haskell dev version"
.