Commit Graph

121 Commits

Author SHA1 Message Date
Bart Schuurmans 489cbd59f4
servant-client: Run ClientEnv's makeClientRequest in IO (#1595)
* servant-client: Run ClientEnv's makeClientRequest in IO

* Add changelog.d entry for #1595
2022-07-01 13:25:13 +02:00
Gaël Deest 658217b021 Use toEncodedUrlPiece directly when encoding captures
Current implementation of captures uses the `toUrlPiece` method from the
`ToHttpApiData` typeclass, and encodes the resulting `Text` using `toEncodedUrlPiece`
when appending to the request path.

The problem with this approach is that the instance for `Text` percent-encodes
characters that are perfectly valid in URLs, such as `*`.

This patch makes direct use of `toEncodedUrlPiece`, which lets users implement
encoding according to their needs.

Closes #1511
2022-03-21 17:29:23 +01:00
Giorgio Marinelli 29d2553e74
Derive HasClient good response status from Verb status (#1469) 2021-12-09 10:09:18 +01:00
Gaël Deest d81c8d9911 Add parameter-supplying operator
Renamed `(/:)` to `(//)`, and used `(/:)` for supplying parameters to
client functions.

Should close #1442.
2021-11-18 10:11:45 +01:00
Gaël Deest 6718752b4a Add (/:) operator 2021-11-18 10:11:31 +01:00
Gaël Deest 5f8aaec146 Fix client tests 2021-11-18 10:11:31 +01:00
Gaël Deest 5ead291f8d Implementation of HasClient
Follows the same design as `HasServer` in the previous commit.

A test has been added (which incidentally acts as a test for the
HasServer instance).
2021-11-18 10:09:58 +01:00
Ian Shipman 9666f1956b Addresses problems with URL encodings
This changes the way URL encoding for query parameters is handled,
making it possible to correctly encode arbitrary binary data into query
parameter values.

Closes #1418
2021-10-03 09:57:55 -05:00
akhesaCaro 6e5dffbb91 unsupporting GHC < 8.6.5, removing unecessary imports 2021-10-02 13:13:24 +02:00
Paolo Capriotti 19ec395e66
Avoid using SOP constructors directly (#1434)
This is a followup to #1420. It uses `respond` and `matchUnion`, with
the help of some type annotations, instead of the NS constructors from
SOP.
2021-07-13 10:10:30 -05:00
Paolo Capriotti 0f9cc7eeec
Add response header support to UVerb (#1420)
* Use type wrapped in Headers h to generate response

This avoids having to define MimeRender instances for Headers.
2021-06-10 17:10:50 +02:00
Andrey Prokopenko da0c83d318
Add URI fragment as a separate combinator (#1324) 2020-11-18 21:57:20 +03:00
fisx c1105899f4
union verbs (#1314) 2020-10-31 20:45:46 +01:00
Eric Torreborre 164ae93c31 added a function to create Client.Request in ClientEnv 2019-12-14 22:34:06 +02:00
Catherine Galkina 0cbed24f23 Added HasClient and HasForeign instances for NoContentVerb 2019-09-29 14:18:13 +03:00
Przemysław Kopański c780e349a0 Fix Verb with headers checking content type differently 2019-08-11 21:19:34 +02:00
Mateusz Curylo a91cde109f ClientSpec split into multiple modules 2019-03-31 13:21:17 +01:00
Oleg Grenrus a5655f8d5a Rename ServantError to ClientError, ServantErr to ServerError 2019-02-18 22:51:09 +02:00
Oleg Grenrus 420ebd0475 Refactor servant-client-core
- No more Internal modules
- Remove ClientLike-generic. Let's use Routes-generics
    - Let's see if anyone notices, otherwise we can add it back
- Add Makefile for common tasks
    - Fix servant-client-ghcjs
2019-02-18 19:08:13 +02:00
Clement Delafargue 82a2c1f463 keep structured exceptions in `ConnectionError`
fixes #807
Previously, there were two levels of `SomeException` (see #714). A
test makes sure there is only one level of wrapping.
2019-02-05 12:46:06 +02:00
Oleg Grenrus fdd1c7392b
Merge pull request #1114 from phadej/bgamari-request-in-failureresponse
Bgamari request in failureresponse
2019-02-05 12:25:50 +02:00
Ben Gamari 9a655fd68e client: Preserve failing request in FailureResponse
This was previously implemented in #470 but later unintentionally
reverted in #803. This isn't verbatim the design implemented earlier; we
now capture the full RequestF save the request body.

Fixes #978.
2019-02-03 12:09:18 -05:00
Oleg Grenrus e9466b7752 Implement HasClient (StreamBody ... :> api) 2019-02-02 15:50:23 +02:00
Domen Kožar e49b0369c0 servant-client: add a test case for StreamBody 2019-02-02 11:01:26 +02:00
Oleg Grenrus 28ac8c072b
Merge pull request #1104 from michaelsdunn1/master
Update CookieJar with intermediate request/responses using Network.HTTP.Client.HistoriedResponse.
2019-02-02 10:21:21 +02:00
Michael Dunn 07b3236eb6 Added Cookie in CookieJar after redirect test case to ClientSpec.hs. 2019-01-25 10:17:58 -06:00
Oleg Grenrus b685efecbe Allow network-3.0 2019-01-23 02:20:16 +02:00
Oleg Grenrus 8feda81fcd Separate Servant.Client.Streaming
- as a bonus only `servant-client` depends on `kan-extensions`
2018-11-08 17:58:21 +02:00
Oleg Grenrus 7634e08352 Make ComprehensiveAPI part of public API
We cannot simply tweak it, it will break tests of other packages.
Including packages not in this repository.
2018-11-06 13:35:47 +02:00
Oleg Grenrus 45c1cbdfd5 Refactor Stream stuff
- Introduce SourceT, which is simple variant of "correct `ListT`".
  There are another variants possible (like in `streaming`),
  but I'm not sure there's much real difference.

- Introduce `Codensity`. There's a flag if people don't want to depend
  on `kan-extensions`.

- `StreamGenerator` and `ResultStream` are both `SourceT`.
  `Stream` combinator in `servant-client` uses `Codensity` for CPS.

- Add servant-machines, servant-conduit, servant-pipes
- Add streaming cookbook: just code, no explanations.
- Add a script to run streaming 'benchmarks'
2018-11-05 15:48:47 +02:00
Oleg Grenrus cfade67c2f Cleanup pre-GHC-8.0 stuff 2018-07-11 01:39:38 +03:00
Oleg Grenrus f536c90fa5 Disable flawed streams in constant memory test 2018-07-05 23:39:02 +03:00
Oleg Grenrus f9bcc15d0b Apply stylish-haskell on all modules 2018-06-29 23:36:39 +03:00
Oleg Grenrus dcc67f3089 Add FromResultStream/ToStreamGenerator [a] instances.
- Add Streaming endpoint to the comprehensive API.
- Rename BuildFromStream to FromResultStram
   - I'm tempted to rename everything in the Servant.API.Stream
     (add some prefixes, `header` is too good name to steal)

The TODO in `servant-docs` is left intentionally.
2018-06-24 21:52:09 +03:00
Oleg Grenrus a66aa8a981
Merge pull request #959 from jvanbruegge/fix-stream
Change definition of StreamGenerator
2018-05-28 09:26:53 +03:00
Oleg Grenrus c56fda3869 Support GHC-8.4.1 and newer deps 2018-05-26 01:06:36 +03:00
Jan van Brügge b80a3e6279 Add `NoFraming` strategy 2018-05-24 05:08:48 +02:00
Oleg Grenrus dd7ec1dfd7 Allow base-compat-0.10.0 2018-04-11 11:26:14 +03:00
Alp Mestanogullari 9eb57a6119 add a test for hoistClient 2018-04-04 01:48:48 +02:00
Julian K. Arni 7c901dcb7d Re-review changes.
Using random packages mysteriously fail on CI, and also uses a lot
    more CPU.
2018-03-19 18:22:49 +01:00
Julian K. Arni d78543575b Review fixes 2018-03-19 18:10:46 +01:00
Julian K. Arni 37482d69d7 Test that Stream combinator doesn't blow up memory. 2018-03-19 16:26:57 +01:00
Michal Rus e4bd07a907 Support http-client’s CookieJar in servant-client 2018-01-26 18:45:52 +02:00
Oleg Grenrus cbd3862f24
Merge pull request #836 from gbaz/gb-streaming
Stream endpoint support for servant
2017-12-03 17:19:47 +02:00
Oleg Grenrus bd7f6edb8b Try to add test for root client request 2017-11-06 14:11:05 +02:00
Gershom 38e87397e7 add tests, fix to make tests work 2017-11-04 00:10:29 -04:00
Julian K. Arni e8b9814168 Documentation and Reexport module 2017-09-14 09:54:13 -04:00
Julian K. Arni ffbfa42a14 Tests now pass 2017-09-14 09:54:13 -04:00
Julian K. Arni 5bd9d253ce Almost compiling test 2017-09-14 09:54:13 -04:00
Julian K. Arni 75ea91c34d Fix some tests 2017-09-14 09:54:13 -04:00