Implements CSV resnponse for the appropriate accept headers

This commit is contained in:
Diogo Biazus
2015-08-14 11:04:26 -04:00
parent ca40ba1fda
commit 9d5011e864
4 changed files with 40 additions and 6 deletions
+7
View File
@@ -3,6 +3,7 @@ module Feature.QuerySpec where
import Test.Hspec
import Test.Hspec.Wai
import Test.Hspec.Wai.JSON
import Network.HTTP.Types
import Network.Wai.Test (SResponse(simpleHeaders))
import SpecHelper
@@ -121,6 +122,12 @@ spec =
it "without other constraints" $
get "/items?order=asc.id" `shouldRespondWith` 200
describe "Accept headers" $
it "should respond with CSV to 'text/csv' request" $
request methodGet "/simple_pk"
(acceptHdrs "text/csv") ""
`shouldRespondWith` "k,extra\rxyyx,u\rxYYx,v"
describe "Canonical location" $ do
it "Sets Content-Location with alphabetized params" $
get "/no_pk?b=eq.1&a=eq.1"