servant Questions

2

Solved

I am trying to relay some ByteString back to the client (browser). The client will not know the content-type of the document being requested so I am trying to send appropriate content-type response...
Tigre asked 25/2, 2016 at 19:43

2

A servant-server Handler is a newtype wrapper over an ExceptT, and has instances for MonadThrow, MonadCatch, MonadError, etc. This might be a somewhat contrived example, but it shows an issue I of...
Trainor asked 28/3, 2018 at 6:43

4

Solved

How do I define a Server-Sent Event(SSE) end point for servant. The docs don't seem to cover this case. If Servant is not designed for the realtime use case, which Haskell server framework support...
Labrador asked 16/6, 2016 at 13:30

0

I want to write API endpoint that would return different http code depending on incoming parameter and state of external world. In python, it would look like following (wsgi): def application(envir...
Jake asked 25/6, 2020 at 19:43

1

I have a servant app and have looked through the following issues for my problem I am getting a 400 for preflight request with the OPTIONS verb: https://github.com/haskell-servant/servant/issues/1...
Paiz asked 23/1, 2020 at 21:26

1

Solved

I'm trying to replicate this curl request with Haskell Servant curl -v -H 'Accept: application/vnd.twitchtv.v5+json' \ -H 'Client-ID: someapikey' \ -X GET 'https://api.twitch.tv/kraken/clips/top?g...
Jessikajessup asked 11/7, 2019 at 9:47

1

using the run from Network.Wai.Handler.Warp function to server rest api run :: Port -> Application -> IO () but while doing post request, getting an error CORS header ‘Access-Control-Allow...
Noon asked 17/11, 2017 at 9:3

1

Solved

Can anyone please provide me with a minimal example of cookies with servant-server, wai, warp, etc.? For example, a cookie with a single field "language" with value "en" Is there an easy way like...
Resa asked 17/3, 2018 at 16:33

3

Solved

I'd like to get current route that corresponds to my handler. Here is mockup of my server just for reference: type ServerAPI = "route01" :> Get '[HTML] Text :<|> "route02" :> "subro...
Conformity asked 8/1, 2017 at 22:8

3

I have the following code which grabs two pages of data from a paginated API endpoint. I'd like to modify query function to keep getting pages until it finds no more data (so replace take 2 in the ...
Greenway asked 4/5, 2018 at 15:52

1

Solved

An API protected with Basic Authentication type SubApi = API1 :<|> API2 :<|> API3 type API = BasicAuth "foo-realm" AuthData :> SubApi supports handlers of type AuthData -> Hand...
Rigney asked 14/5, 2016 at 16:23

3

Solved

When using servant, I'd like to return all errors as JSON. Currently, if a request fails to parse, I see an error message like this, returned as plain text Failed reading: not a valid json value ...
Engineman asked 19/1, 2017 at 23:21

2

Solved

I was reading the Servant documentation and came across this line: type UserAPI = "users" :> QueryParam "sortby" SortBy :> Get '[JSON] [User] What is the ' doing to that list?
Kruger asked 1/7, 2017 at 20:8

2

Solved

How can I handle regular form POSTs with Servant? In particular, given an HTML form like <form action="/check" method="post"> Solution: <input name="code" type="text"> <input typ...
Delorisdelorme asked 2/10, 2016 at 17:34

1

Solved

I'm using version 0.4 of reflex-dom and I have a tiny reflex-dom client: {-# LANGUAGE OverloadedStrings #-} import Reflex.Dom import qualified Data.Text as T import Data.Monoid main :: IO () mai...
Plains asked 9/2, 2017 at 17:28

1

Solved

I'm working on an API integration that ignores the existence of XML or JSON in favor of just appending character data. (The Metro2 format, if interested) I'm simplifying, but imagine that a person...
Clearly asked 18/11, 2016 at 0:53

1

Consider the following data type: data Get (statusCode :: Nat) Actually, it's a simplified type constructor from servant which is then used in a type-level API like this: type API = "users" :&g...
Evetteevey asked 6/9, 2016 at 8:28

2

Solved

I am trying to gork the tutorial for the servant library, a type-level web DSL. The library makes extensive use of the DataKind language extension. Early in that that tutorial we find the followin...
Medial asked 4/5, 2016 at 1:11

1

Solved

I have a simple hello world Servant application. I need to add some static or dynamic html pages to it. How can I do that? In the documentation it's not mentioned. Note I don't want to create a htm...
Stomatitis asked 2/4, 2016 at 11:51

1

Solved

I have kind of a hello world app in Haskell servant, here's a part of it: type API = "my_items" :> Get '[JSON] [MyItem] :<|> "my_items" :> Capture "id" Int :> Get '[JSON] MyItem ...
Raoul asked 27/3, 2016 at 4:19

2

Solved

I am trying to figure out how to add CORS response header in Servant (basically, set a response header "Access-Control-Allow-Origin: *"). I wrote a small test case below with addHeader function but...
Pallium asked 8/2, 2016 at 4:35

1

I am trying to add a functionality to my servant server that would get a file from Amazon S3 and stream it back to the user. Because files can be big I don't want to download them locally and then ...
Demagogy asked 24/1, 2016 at 9:45

1

Solved

I am following this tutorial http://www.parsonsmatt.org/programming/2015/06/07/servant-persistent.html to create APIs through servant. I want to customize the server to serve static files as well b...
Hibbert asked 24/6, 2015 at 7:20
1

© 2022 - 2025 — McMap. All rights reserved.