Usage of optional Header (Maybe Header and etc)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Usage of optional Header (Maybe Header and etc)

ruslan yurov
Hi all)

I'm using Servant (very good library :-) ) and it is interesting for me to know is there any way to have header optional?
type GetNames = "names" :> Get '[JSON] (Maybe(Headers '[Header "smth" String]) [Name]) or
type GetNames = "names" :> Get '[JSON] (Headers '[Maybe(Header "smth" String)] [Name])

--
Reply | Threaded
Open this post in threaded view
|

Re: Usage of optional Header (Maybe Header and etc)

Nigel Rantor-2
I hit the same problem and since then there has been the addition of noHeader, see below;

https://hackage.haskell.org/package/servant-0.9.1.1/docs/Servant-API-ResponseHeaders.html#v:noHeader

You may need to upgrade to get it.

  n

On Thursday, 20 October 2016 15:35:29 UTC+1, ruslan yurov wrote:
Hi all)

I'm using Servant (very good library :-) ) and it is interesting for me to know is there any way to have header optional?
type GetNames = "names" :> Get '[JSON] (Maybe(Headers '[Header "smth" String]) [Name]) or
type GetNames = "names" :> Get '[JSON] (Headers '[Maybe(Header "smth" String)] [Name])

--