Commit graph

96 commits

Author SHA1 Message Date
Oleg Grenrus
cfade67c2f Cleanup pre-GHC-8.0 stuff 2018-07-11 01:39:38 +03:00
Oleg Grenrus
374a7b88fb Deprecate S.Utils.StaticFiles in favor of S.Server.StaticFiles 2018-07-05 23:20:59 +03:00
Oleg Grenrus
f9bcc15d0b Apply stylish-haskell on all modules 2018-06-29 23:36:39 +03:00
Jonathan Lange
972ed49dd4 Run captureAllSpec
This was missed due to an oversight.
2018-06-10 17:38:22 +01:00
Oleg Grenrus
1614ca59bf Add test for Stream status setting 2018-06-09 09:37:05 +03:00
Giovanni Cappellotto
92f8d2314e Update request content-type handling
In case that a sub-server doesn't support the content-type specified
in the request invoke `delayedFail` instead of `delayedFailFatal` in
order to give the chance to other sub-servers to handle the request.
2018-04-04 18:53:40 -04:00
Oleg Grenrus
c55b778d8e Bump lower bound of http-types >= 0.12
- WIP: pending http-api-data release
- TODO: remove MIN_VERSION_http_types
- There have been 3 major releases of http-types:
  - 0.10 change name of variable
  - 0.11 lowercase escaped URIs
  - 0.12 uppercase escaped URIs
- It's easier for us to support only latest, migration from 0.9/0.10 to 0.12
  is trivial for the downstream. 0.11 may cause semantic (non-type-error) breakage somewhere.

Also allow lens-4.16, remove MIN_VERSION_http_types conditionals, and
update `stack.yaml`
2018-01-30 11:29:25 +02:00
Oleg Grenrus
bc3f61d615 Add Servant.API.Modifiers to servant
Changes Header, ReqBody and QueryParam to take a modifier list.

Resolves https://github.com/haskell-servant/servant/issues/856

ResponseHeader story turns to be somewhat ugly, but it can be made
elegant when https://github.com/haskell-servant/servant/issues/841 is
implemnted, then we can omit HList aka Header Heterogenous List
implementation.

- servant-server changes:

  Writing server side intepretations is quite simple using
  `unfoldRequestArgument`, which makes Header and QueryParam look quite
  the same.

  `ReqBody` cannot be easily made optional with current design (what that
  would mean: No Content-Type Header?), so that dimensions isn't used
  there.

- Add HasLink for all the rest ComprehensiveAPI combinators
- Add 'tricky' Header', QueryParam' endpoints to ComprehensiveAPI
- servant-docs: Quick'n'dirty implementation. Don't use modifiers information (yet).
2018-01-25 09:10:11 +02:00
Oleg Grenrus
09485871f5 Adopt http-types-0.10 2017-10-23 08:59:36 +03:00
Oleg Grenrus
15cc4f55dd Update docs related to hoistServer 2017-10-01 20:24:22 +03:00
Oleg Grenrus
24af338dea Add hoistServer to HasServer 2017-09-14 12:04:34 +03:00
Catherine Galkina
be0878cdd8 Fix tests for different GHC versions 2017-06-19 18:58:25 +03:00
Catherine Galkina
272e47c3d3 Increase stack size for GHC-7.8.4 tests 2017-06-19 14:59:26 +03:00
Oleg Grenrus
705285209a Remove parentheses in ContextSpec 2017-06-03 21:44:40 +03:00
Catherine Galkina
1c6927d3f5 Fix tests for servant-server 2017-06-02 18:47:28 +03:00
Oleg Grenrus
b6cfd64b5a GHC-8.2 readyness 2017-05-24 08:02:57 +03:00
David Turner
f5d9983381 Rename emptyAPIServer to emptyServer 2017-05-16 15:59:41 +00:00
David Turner
937a5c98fd Add test for emptyAPIServer 2017-05-16 10:18:57 +00:00
Alexander Vieth
6389134423 Change to ServerT Raw m = Tagged m Application
For uniformity of Enter.

Previously, `ServerT Raw m ~ Application`. Seems reasonable, but has the
unfortunate consequence of making `Enter` useless for `Raw` routes.
With this change `Tagged m Application` is retagged by `Enter`.
2017-05-15 19:54:43 +03:00
Oleg Grenrus
d0048057cd Merge pull request #736 from phadej/entered
Redo Enter
2017-05-05 10:17:34 +03:00
Oleg Grenrus
e2665391f9 Redo Enter 2017-04-28 14:31:57 +03:00
Philipp Balzarek
08786aadbe Check for parse errors in HasServer Header instance 2017-04-06 14:52:55 +02:00
Oleg Grenrus
7ac095f19a Add test illustating that query params don't affect router grouping 2017-01-19 23:07:11 +02:00
Oleg Grenrus
58e931f48a Resolve todos 2017-01-19 11:26:50 +02:00
Philipp Balzarek
3a0cbdd0f6 throw 400 on query parameter parse failure 2017-01-19 11:09:30 +02:00
Oleg Grenrus
6527937e27 More robust testing, via resource state machine 2017-01-19 00:57:31 +02:00
Oleg Grenrus
091f6f4412 Add failing test 2017-01-19 00:57:31 +02:00
Oleg Grenrus
bc6ff20f4d Use resourcet for resource managment 2017-01-19 00:57:31 +02:00
Oleg Grenrus
7793b52d23 Change JSON content type to add the charset 2017-01-18 13:40:18 +02:00
Oleg Grenrus
60ee1ab570 Rewrite delayed cleanup tests using IORefs 2017-01-18 10:26:23 +02:00
Alp Mestanogullari
92786feead add some basic tests for the cleanup machinery in Delayed 2017-01-17 22:29:37 +02:00
Alp Mestanogullari
0a3b2272de fix static file serving test 2017-01-17 14:14:46 +02:00
Oleg Grenrus
5168157757 Make Handler a newtype 2017-01-16 12:18:49 +02:00
Oleg Grenrus
d5e73bf577 Make servant buildable with cabal new-build 2017-01-16 11:03:06 +02:00
Oleg Grenrus
85feb31cbb Fix hspec-wai issue 2017-01-01 20:52:18 +02:00
Alex Mason
5bef76ed03 Remove all use of bytestring-conversion 2016-09-02 23:27:37 +10:00
Jonathan Lange
c79a254b36 servant-server support for CaptureAll 2016-07-11 14:46:31 +01:00
Arian van Putten
05379ed7e3 Replace all occurances of () with NoContent
We use NoContent to signify an empty response nowadays. This commit
replaces all occurences of () with NoContent so that all packages use
the new semantics.
2016-07-10 16:58:59 +02:00
Julian Arni
ea36656dcd Merge pull request #505 from haskell-servant/jkarni/reexport-application
Re-export Application.
2016-05-12 10:38:46 +02:00
Julian K. Arni
211254512e Re-export Application. 2016-05-11 12:17:36 +02:00
Amar
845a06ccbd Correct the description of arbitrary monad server spec 2016-04-28 22:27:50 +08:00
Amar
a948639673 Move enter to servant package 2016-04-28 22:13:04 +08:00
Sönke Hahn
b26bbfccda travis: enable -Wall -Werror 2016-04-21 13:06:10 +08:00
Andres Loeh
a551eb62e2 Do the accept check before the body check.
This is a reasonably simple attempt at fixing #460.
By moving the accept check to a place before the body check,
we can make it recoverable (the body check is irreversible,
so everything done after the body check has to fail fatally).

The advantage is that we can now specify routes offering
different content types modularly. Failure to match one
is not fatal, and will result in subsequent routes being
tried.

The disadvantage is that we hereby bump the error priority
of the 406 status code. If a request contains a bad accept
header and a bad body, we now get 406 rather than 400. This
deviates from the HTTP decision diagram we try to follow,
but seems like an acceptable compromise for now.
2016-04-15 10:54:22 +02:00
Andres Loeh
b1a6d88845 Revise the Router type to allow proper sharing.
We've previously used functions in the Router type to provide
information for subrouters. But this accesses the Requests too
early, and breaks sharing of the router structure in general,
causing the Router or large parts of the Router to be recomputed
on every request.

We now do not use functions anymore, and properly compute all
static parts of the router first, and gain access to the request
only in Delayed.

This also turns the code used within Delayed into a proper monad
now called DelayedIO, making some of the code using it a bit
nicer.
2016-04-12 09:38:49 +02:00
Luke Cycon
21546991af Introduce a Handler alias for ExceptT ServantErr IO
Fixes #434
2016-04-11 22:27:29 -07:00
Andres Loeh
8c778825c7 Improvements and visualization of router structure.
* Improves how Routers are built, in particular via
the `choice` smart constructors. Static lookups are
now used more often.

* We now have test cases making sure that certain
routers have the same structure.

* The router structure can now be visualized for debugging
purposes as a tree. The new functions `layout` and
`layoutWithContext` do this.
2016-04-11 08:08:37 +02:00
Sönke Hahn
8bf81190b2 add one more auth test
just to clarify on how to use it properly
2016-04-07 19:10:11 +08:00
aaron levin
8a0c3a9497 Add test: Gen Auth properly supports Raw endpoints 2016-04-06 13:45:44 +02:00
Sönke Hahn
6df3429b68 refactored basic auth test cases 2016-04-06 16:44:40 +08:00