Skip to content

Add getFullUri #74

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions Network/Wreq.hs
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ import Data.Maybe (fromMaybe)
import Data.Text (Text)
import Data.Text.Encoding (encodeUtf8)
import Network.HTTP.Client.Internal (Proxy(..), Response)
import Network.URI (URI)
import Network.Wreq.Internal
import Network.Wreq.Types (Options)
import Network.Wreq.Types hiding (Options(..))
Expand Down Expand Up @@ -359,6 +360,11 @@ customMethodWith method opts url = runRead =<< prepareMethod methodBS opts url
where
methodBS = BC8.pack method

-- | Get full 'URI' of a get-request, including protocol, query-parameters etc.
-- Convenient for debugging.
getFullUri :: Options -> String -> IO URI
getFullUri opts url = return . HTTP.getUri =<< prepare return opts url

foldGet :: (a -> S.ByteString -> IO a) -> a -> String -> IO a
foldGet f z url = foldGetWith defaults f z url

Expand Down
1 change: 1 addition & 0 deletions Network/Wreq/Internal.hs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ module Network.Wreq.Internal
, preparePut
, prepareDelete
, prepareMethod
, prepare
) where

import Control.Applicative ((<$>))
Expand Down
35 changes: 35 additions & 0 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# For more information, see: https://github.com/commercialhaskell/stack/wiki/stack.yaml

# Specifies the GHC version and set of packages available (e.g., lts-3.5, nightly-2015-09-21, ghc-7.10.2)
resolver: lts-3.5

# Local packages, usually specified by relative directory name
packages:
- '.'
- examples/

# Packages to be pulled from upstream that are not in the resolver (e.g., acme-missiles-0.3)
extra-deps: []

# Override default flag values for local packages and extra-deps
flags:
wreq:
aws: false
doctest: true
httpbin: false
developer: false

# Control whether we use the GHC we find on the path
# system-ghc: true

# Require a specific version of stack, using version ranges
# require-stack-version: -any # Default
# require-stack-version: >= 0.1.4.0

# Override the architecture used by stack, especially useful on Windows
# arch: i386
# arch: x86_64

# Extra directories used by stack for building
# extra-include-dirs: [/path/to/dir]
# extra-lib-dirs: [/path/to/dir]
1 change: 1 addition & 0 deletions wreq.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ library
lens >= 4.5,
lens-aeson,
mime-types,
network-uri,
old-locale,
template-haskell,
text,
Expand Down