Commit graph

2392 commits

Author SHA1 Message Date
Alp Mestanogullari
e450e531c1 Merge pull request #152 from haskell-servant/jkarni/cabal0file-fixes
Cabal file fixes
2015-07-10 00:51:56 +02:00
Julian K. Arni
5db91c9ecb Cabal file fixes 2015-07-09 23:34:21 +02:00
Christian Marie
490a84cda1 Merge pull request #150 from haskell-servant/pingu/jquery-post-content-type-take2
servant-jquery: set content type to application/json on POST
2015-07-09 10:58:36 +10:00
bwo
f6196aea4d servant-jquery: set content type to application/json on POST
Also remove some redundant newlines in generated JS.
2015-07-09 09:42:44 +10:00
Alp Mestanogullari
9c50804c6f Merge pull request #147 from haskell-servant/pingu/fix-bump-versions-script
Make bump-versions.sh work
2015-07-07 08:29:23 +02:00
Christian Marie
627158845b Make bump-versions.sh work
This also makes it behave when called from from any directory.
2015-07-06 17:05:45 +10:00
Alp Mestanogullari
fa6cfbb539 Merge pull request #94 from haskell-servant/tvh/simpler-error
Don't export HttpException
2015-07-02 00:59:14 +02:00
Christian Marie
472249e92c Merge pull request #119 from haskell-servant/existential-error
servant-client: Hide HttpException by wrapping it in SomeException
2015-06-24 12:02:54 +10:00
Julian Arni
d27c7c0c6f Merge pull request #140 from oswynb/fix-aeson-test
Fix ordering of CPP directive for aeson test
2015-06-23 16:51:52 +02:00
Oswyn Brent
8eb592bc15 Fix ordering of CPP directive for aeson test
If the version of aeson used is below 0.9 the current ordering
results in an empty do block.
2015-06-23 14:55:13 +10:00
Alp Mestanogullari
7399f30cc4 Merge pull request #132 from haskell-servant/fix-129-queryparam-link
Tweak the HasLink instance for QueryParam, fixes #129
2015-06-19 22:16:34 +01:00
Alp Mestanogullari
0e22d19800 Make Link take a Maybe argument for MatrixParam, just like QueryParam 2015-06-19 11:30:44 +02:00
Alp Mestanogullari
82328247e6 Fix doctests for Link/QueryParam 2015-06-19 10:29:06 +02:00
Alp Mestanogullari
9fbd312b4c adapt tests to the modified HasLink instance for QueryParam 2015-06-19 10:03:24 +02:00
Alp Mestanogullari
e8bae7d035 Tweak the HasLink instance for QueryParam, fixes #129 2015-06-18 18:03:48 +02:00
Alp Mestanogullari
9b9ea1059c Merge pull request #130 from haskell-servant/fix-128
Add (missing) HasLink instance for Header. Fixes #128
2015-06-18 14:29:36 +01:00
Alp Mestanogullari
8b38344494 remove tabs 2015-06-18 13:09:18 +02:00
Alp Mestanogullari
ee0372e0bf Add HasLink instance for Header. Fixes #128 2015-06-18 12:40:00 +02:00
Alp Mestanogullari
13edc014b7 clarify some variable names in the examples + semantic html pedantry 2015-06-18 12:32:00 +02:00
Alp Mestanogullari
74423feed0 Merge pull request #124 from kantp/fix-docswith
servant-docs: Fix docsWith.
2015-06-17 10:22:28 +01:00
Philipp Kant
529139eb03 Added test for docsWith.
Make sure that no information is lost when providing additional
information via docsWith. With the current left-biased implementation of
combineAction, this can happen if the function arguments are in the
wrong order.
2015-06-16 22:38:14 +02:00
Philipp Kant
8dc6d9a7d4 servant-docs: Fix docsWith.
When adding extra info using using docsWith, the responses vanished from
the output. This was due to combineAction being left-biased, and
docsWith combining the extra info with the enpoint (in that
order). Flipping combineAction solves this.
2015-06-16 10:58:15 +02:00
Julian K. Arni
56b91b1d77 Remove verbose flag from cabal install for travis 2015-06-12 17:07:49 +02:00
Alp Mestanogullari
dfa30e890c Merge pull request #120 from haskell-servant/jkarni/travis_retry
travis retry - for a less lame CI story!
2015-06-12 15:35:07 +01:00
Julian K. Arni
bef0e880cb Fix sporadic eitherDecodeLenient test failures 2015-06-12 15:45:51 +02:00
Julian K. Arni
a9085287fa travis fixes 2015-06-12 15:45:27 +02:00
Julian K. Arni
e022ad0b23 Add travis_retry bash function 2015-06-12 14:37:41 +02:00
Julian K. Arni
29de4f53d1 travis retry 2015-06-12 13:34:46 +02:00
Christian Marie
a4bf32c51a servant-client: Hide HttpException by wrapping it in SomeException 2015-06-12 21:19:26 +10:00
Christian Marie
ad16c4f768 Merge branch 'master' into existential-error 2015-06-12 19:56:49 +10:00
Julian K. Arni
ab19ea884a Fix upload script issues 2015-06-09 12:51:58 +02:00
Julian Arni
9e9329c784 Merge pull request #116 from haskell-servant/upload-script
Upload script and some script refactoring
2015-06-05 16:56:33 +02:00
Julian K. Arni
a621b1d854 Fix DIR issues 2015-06-05 15:22:23 +02:00
Julian K. Arni
aec39b546e Upload script and some script refactoring 2015-06-05 14:40:05 +02:00
Alp Mestanogullari
c162e10676 Merge pull request #115 from haskell-servant/jkarni/patch-safe-link
Add missing Patch case for safeLink
2015-06-05 12:44:03 +01:00
Julian K. Arni
8b0ade729e Add missing Patch case for safeLink 2015-06-05 12:18:01 +02:00
Alp Mestanogullari
664691e1ba Merge pull request #114 from haskell-servant/jkarni/bump-string-conversions
Bump string-conversions
2015-06-04 14:56:40 +01:00
Alp Mestanogullari
e208977700 Merge pull request #112 from haskell-servant/jkarni/content-type-performance-fix
Don't render header via String
2015-06-04 14:23:58 +01:00
Julian K. Arni
d5091a68e1 Bump string-conversions 2015-06-04 15:09:01 +02:00
Julian Arni
e8f7c69aca Merge pull request #89 from PierreR/master
Use MonadThrow instead of Either in the signature of parseBaseUrl
2015-06-04 14:32:54 +02:00
Julian K. Arni
fb26e134d5 Don't render header via String 2015-06-04 14:28:28 +02:00
Alp Mestanogullari
d654ccaf3d Merge pull request #111 from haskell-servant/improved-routing
Improved routing
2015-06-04 12:57:45 +01:00
Andres Loeh
31b12d4bf4 Refactoring: abstracting common parts of method handlers.
This change makes an attempt of abstracting out some of the common
functionality found in the handlers for the different request methods.
There's still a bit of code duplication between the cases for headers
and no headers and empty responses. But it's a significant relative
improvement already.
2015-06-04 13:14:51 +02:00
Andres Loeh
eb86a82105 Refactoring: one module per concept.
The main `Server.Internal` module was getting a bit large for my taste.
It now contains just the instances. All the administrative utilities
are in their own dedicated modules.
2015-06-04 13:14:31 +02:00
Andres Loeh
e83397a1db Fix the auth combinator example.
This change adapt the auth combinator example to the new router code.
In general, the server interpretation of user-written combinators will
be affected by the new routing code.

The change here also introduces a change in functionality: previously,
wrong authentication triggered a "hard failure", whereas we now trigger
a "soft failure", which is recoverable. For the simple example, this
does not make a lot of difference.

In general, I think having a soft failure is the right option to take
here, although we want a more general story about the relative
priorities of different error codes.
2015-06-04 13:12:21 +02:00
Andres Loeh
404bfdd89c Add test cases for the priority of error codes.
Due to the delayed treatment of checks during the server interpretation,
we now have the ability to produce "better" error codes for certain
APIs. This change introduces test cases for some of these situations and
their new, desired results. These tests would mostly fail with the old
approach to routing.
2015-06-04 13:10:21 +02:00
Andres Loeh
f9b1e7fc50 Switch server interpretation to a datatype for efficiency.
Instead of directly interpreting a server as a `RoutingApplication`,
this change introduces the concept of a `Router`, which is a datatype
with several constructors.

In particular, the type of the `route` function changes from

    route :: Proxy layout -> Server layout -> RoutingApplication

to

    route :: Proxy layout -> IO (RouteResult (Server layout)) -> Router

Most important in practice is the case of the `StaticRouter` constructor
in `Router`. For choices between statically known paths, we can now use
a lookup table to dispatch requests rather than trying each request
individually.

This brings down routing complexity of a common case from
O(n) to O(log n).

Another important change is that the handler that is passed down by
`route` is no longer of type `Server layout`, but of type
`IO (RouteResult (Server layout))`. This means that API constructs
can "delay" checks and failure. For example, `ReqBody` does not have
to fetch the request body and feed it to the handler immediately; it
can instead record these actions in the handler that is passed down.
The code will only be executed at a leaf / endpoint of the API.

This is desired behaviour: We prefer to save work by doing all matching
on static path components first. Furthermore, we get better error codes
by doing so.
2015-06-04 13:07:53 +02:00
Julian Arni
2725e20a1a Merge pull request #110 from bgamari/master
Bump aeson bound
2015-06-03 15:32:18 +02:00
Ben Gamari
74a52df1a1 API.Capture: Fix haddocks 2015-06-03 07:13:49 -04:00
Ben Gamari
939a008b67 Bump aeson bound 2015-06-03 06:53:34 -04:00