Merge branch 'master' of github.com:yesodweb/yesod
This commit is contained in:
commit
07df43f207
@ -43,3 +43,4 @@ extra-deps:
|
|||||||
- websockets-0.12.3.1
|
- websockets-0.12.3.1
|
||||||
- th-abstraction-0.2.6.0
|
- th-abstraction-0.2.6.0
|
||||||
- persistent-template-2.5.3.1
|
- persistent-template-2.5.3.1
|
||||||
|
- th-lift-instances-0.1.11
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
## 1.6.4
|
||||||
|
|
||||||
|
* Add `addContentDispositionFileName` [#1504](https://github.com/yesodweb/yesod/pull/1504)
|
||||||
|
|
||||||
## 1.6.3
|
## 1.6.3
|
||||||
|
|
||||||
* Add missing export for `SubHandlerFor`
|
* Add missing export for `SubHandlerFor`
|
||||||
|
|||||||
@ -118,6 +118,7 @@ module Yesod.Core.Handler
|
|||||||
, setHeader
|
, setHeader
|
||||||
, replaceOrAddHeader
|
, replaceOrAddHeader
|
||||||
, setLanguage
|
, setLanguage
|
||||||
|
, addContentDispositionFileName
|
||||||
-- ** Content caching and expiration
|
-- ** Content caching and expiration
|
||||||
, cacheSeconds
|
, cacheSeconds
|
||||||
, neverExpires
|
, neverExpires
|
||||||
@ -780,6 +781,26 @@ deleteCookie a = addHeaderInternal . DeleteCookie (encodeUtf8 a) . encodeUtf8
|
|||||||
setLanguage :: MonadHandler m => Text -> m ()
|
setLanguage :: MonadHandler m => Text -> m ()
|
||||||
setLanguage = setSession langKey
|
setLanguage = setSession langKey
|
||||||
|
|
||||||
|
-- | Set attachment file name.
|
||||||
|
--
|
||||||
|
-- Allows Unicode characters by encoding to UTF-8.
|
||||||
|
-- Some modurn browser parse UTF-8 characters with out encoding setting.
|
||||||
|
-- But, for example IE9 can't parse UTF-8 characters.
|
||||||
|
-- This function use
|
||||||
|
-- <https://tools.ietf.org/html/rfc6266 RFC 6266>(<https://tools.ietf.org/html/rfc5987 RFC 5987>)
|
||||||
|
--
|
||||||
|
-- @since 1.6.4
|
||||||
|
addContentDispositionFileName :: MonadHandler m => T.Text -> m ()
|
||||||
|
addContentDispositionFileName fileName
|
||||||
|
= addHeader "Content-Disposition" $ rfc6266Utf8FileName fileName
|
||||||
|
|
||||||
|
-- | <https://tools.ietf.org/html/rfc6266 RFC 6266> Unicode attachment filename.
|
||||||
|
--
|
||||||
|
-- > rfc6266Utf8FileName (Data.Text.pack "€")
|
||||||
|
-- "attachment; filename*=UTF-8''%E2%82%AC"
|
||||||
|
rfc6266Utf8FileName :: T.Text -> T.Text
|
||||||
|
rfc6266Utf8FileName fileName = "attachment; filename*=UTF-8''" `mappend` decodeUtf8 (H.urlEncode True (encodeUtf8 fileName))
|
||||||
|
|
||||||
-- | Set an arbitrary response header.
|
-- | Set an arbitrary response header.
|
||||||
--
|
--
|
||||||
-- Note that, while the data type used here is 'Text', you must provide only
|
-- Note that, while the data type used here is 'Text', you must provide only
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-core
|
name: yesod-core
|
||||||
version: 1.6.3
|
version: 1.6.4
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Michael Snoyman <michael@snoyman.com>
|
author: Michael Snoyman <michael@snoyman.com>
|
||||||
|
|||||||
@ -1,3 +1,7 @@
|
|||||||
|
## 1.6.3
|
||||||
|
Add performMethod
|
||||||
|
[#1502](https://github.com/yesodweb/yesod/pull/1502)
|
||||||
|
|
||||||
## 1.6.2
|
## 1.6.2
|
||||||
|
|
||||||
* Add byLabel-related functions like byLabelContain
|
* Add byLabel-related functions like byLabelContain
|
||||||
|
|||||||
@ -54,6 +54,7 @@ module Yesod.Test
|
|||||||
, get
|
, get
|
||||||
, post
|
, post
|
||||||
, postBody
|
, postBody
|
||||||
|
, performMethod
|
||||||
, followRedirect
|
, followRedirect
|
||||||
, getLocation
|
, getLocation
|
||||||
, request
|
, request
|
||||||
@ -894,9 +895,7 @@ getRequestCookies = do
|
|||||||
post :: (Yesod site, RedirectUrl site url)
|
post :: (Yesod site, RedirectUrl site url)
|
||||||
=> url
|
=> url
|
||||||
-> YesodExample site ()
|
-> YesodExample site ()
|
||||||
post url = request $ do
|
post = performMethod "POST"
|
||||||
setMethod "POST"
|
|
||||||
setUrl url
|
|
||||||
|
|
||||||
-- | Perform a POST request to @url@ with the given body.
|
-- | Perform a POST request to @url@ with the given body.
|
||||||
--
|
--
|
||||||
@ -925,9 +924,22 @@ postBody url body = request $ do
|
|||||||
get :: (Yesod site, RedirectUrl site url)
|
get :: (Yesod site, RedirectUrl site url)
|
||||||
=> url
|
=> url
|
||||||
-> YesodExample site ()
|
-> YesodExample site ()
|
||||||
get url = request $ do
|
get = performMethod "GET"
|
||||||
setMethod "GET"
|
|
||||||
setUrl url
|
-- | Perform a request using a given method to @url@.
|
||||||
|
--
|
||||||
|
-- @since 1.6.3
|
||||||
|
--
|
||||||
|
-- ==== __Examples__
|
||||||
|
--
|
||||||
|
-- > performMethod "DELETE" 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.
|
-- | Follow a redirect, if the last response was a redirect.
|
||||||
-- (We consider a request a redirect if the status is
|
-- (We consider a request a redirect if the status is
|
||||||
|
|||||||
@ -124,6 +124,9 @@ main = hspec $ do
|
|||||||
yit "tests1b" $ do
|
yit "tests1b" $ do
|
||||||
get ("/foo" :: Text)
|
get ("/foo" :: Text)
|
||||||
statusIs 404
|
statusIs 404
|
||||||
|
yit "tests1c" $ do
|
||||||
|
performMethod "DELETE" ("/" :: Text)
|
||||||
|
statusIs 200
|
||||||
ydescribe "tests2" $ do
|
ydescribe "tests2" $ do
|
||||||
yit "type-safe URLs" $ do
|
yit "type-safe URLs" $ do
|
||||||
get $ LiteAppRoute []
|
get $ LiteAppRoute []
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
name: yesod-test
|
name: yesod-test
|
||||||
version: 1.6.2
|
version: 1.6.3
|
||||||
license: MIT
|
license: MIT
|
||||||
license-file: LICENSE
|
license-file: LICENSE
|
||||||
author: Nubis <nubis@woobiz.com.ar>
|
author: Nubis <nubis@woobiz.com.ar>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user