add performMethod
This commit is contained in:
parent
06e0ffb48b
commit
a7d42846b5
@ -54,6 +54,7 @@ module Yesod.Test
|
||||
, get
|
||||
, post
|
||||
, postBody
|
||||
, performMethod
|
||||
, followRedirect
|
||||
, getLocation
|
||||
, request
|
||||
@ -929,6 +930,21 @@ get url = request $ do
|
||||
setMethod "GET"
|
||||
setUrl url
|
||||
|
||||
-- | Perform a request using a given method to @url@.
|
||||
--
|
||||
-- @since 1.6.3
|
||||
--
|
||||
-- ==== __Examples__
|
||||
--
|
||||
-- > performMethod "GET" HomeR
|
||||
performMethod :: (Yesod site, RedirectUrl site url)
|
||||
=> ByteString
|
||||
-> url
|
||||
-> YesodExample site ()
|
||||
performMethod method url = request $ do
|
||||
setMethod method
|
||||
setUrl url
|
||||
|
||||
-- | Follow a redirect, if the last response was a redirect.
|
||||
-- (We consider a request a redirect if the status is
|
||||
-- 301, 302, 303, 307 or 308, and the Location header is set.)
|
||||
|
||||
@ -124,6 +124,9 @@ main = hspec $ do
|
||||
yit "tests1b" $ do
|
||||
get ("/foo" :: Text)
|
||||
statusIs 404
|
||||
yit "tests1c" $ do
|
||||
performMethod "DELETE" ("/" :: Text)
|
||||
statusIs 200
|
||||
ydescribe "tests2" $ do
|
||||
yit "type-safe URLs" $ do
|
||||
get $ LiteAppRoute []
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
name: yesod-test
|
||||
version: 1.6.2
|
||||
version: 1.6.3
|
||||
license: MIT
|
||||
license-file: LICENSE
|
||||
author: Nubis <nubis@woobiz.com.ar>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user