| Copyright | (c) 2016- hiratara |
|---|---|
| License | BSD-style |
| Maintainer | hiratara@cpan.org |
| Stability | experimental |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Web.ReqCatcher
Description
Web.ReqCatcher starts a local HTTP server which handles just one request and returns that request to the client program. It is useful for CLI program to capture HTTP redirects from outer WEB services by using browser.
import Web.Authenticate.OAuth
oauth :: OAuth
manager :: Manager
main :: IO ()
main = do
c <- newCatcher
let url = pack (catcherUrl c)
oauth' = oauth {oauthCallback = Just url}
credential <- getTemporaryCredential oauth' manager
putStrLn $ "Access to:\n" ++ (authorizeUrl oauth credential)
req <- catchRedirect c
let (Just (Just verifier)) = lookup "oauth_verifier" (queryString req)
...
Synopsis
- data Catcher
- newCatcher :: IO Catcher
- newCatcherWithPort :: Port -> IO Catcher
- catchRedirect :: Catcher -> IO Request