Yesod.Core.Handler.languages checks first for a language set in the
user's session, prepending that value to YesodRequest{reqLangs}, so it
is respected above all else if present.
For context, reqLangs itself also includes the session, but just later
in line:
langs' = catMaybes [ lookup langKey gets -- Query _LANG
, lookup langKey cookies -- Cookie _LANG
, lookupText langKey session -- Session _LANG
] ++ langs -- Accept-Language(s)
In #1720, it was raised that allowing the session (something implicitly
present for any request) to override a query parameter (something
explicitly given on that request) is surprising.
We decided (without knowing what order reqLangs was doing) that query,
cookie, session, accept was best and languages should be changed to do
that. Conveniently, this just makes languages equivalent to reqLangs, so
that is what this patch does.
|
||
|---|---|---|
| .github | ||
| demo | ||
| yesod | ||
| yesod-auth | ||
| yesod-auth-oauth | ||
| yesod-bin | ||
| yesod-core | ||
| yesod-eventsource | ||
| yesod-form | ||
| yesod-form-multi | ||
| yesod-newsfeed | ||
| yesod-persistent | ||
| yesod-sitemap | ||
| yesod-static | ||
| yesod-test | ||
| yesod-websockets | ||
| .gitignore | ||
| CODE_OF_CONDUCT.md | ||
| CONTRIBUTING.md | ||
| Dockerfile | ||
| LICENSE | ||
| README.md | ||
| stack-persistent-211.yaml | ||
| stack-persistent-212.yaml | ||
| stack.yaml | ||
| stack.yaml.lock | ||
Yesod Web Framework
An advanced web framework using the Haskell programming language. Featuring:
- safety & security guaranteed at compile time
- developer productivity: tools for all your basic web development needs
- raw performance
- fast, compiled code
- techniques for constant-space memory consumption
- asynchronous IO
- this is built in to the Haskell programming language (like Erlang)
Getting Started
Learn more about Yesod on its main website. If you want to get started using Yesod, we strongly recommend the quick start guide, based on the Haskell build tool stack.
Here's a minimal example!
{-# LANGUAGE OverloadedStrings, QuasiQuotes, TemplateHaskell, TypeFamilies #-}
import Yesod
data App = App -- Put your config, database connection pool, etc. in here.
-- Derive routes and instances for App.
mkYesod "App" [parseRoutes|
/ HomeR GET
|]
instance Yesod App -- Methods in here can be overridden as needed.
-- The handler for the GET request at /, corresponds to HomeR.
getHomeR :: Handler Html
getHomeR = defaultLayout [whamlet|Hello World!|]
main :: IO ()
main = warp 3000 App
To read about each of the concepts in use above (routing, handlers, linking, JSON), in detail, visit Basics in the Yesod book.
Hacking on Yesod
Yesod consists mostly of four repositories:
git clone --recurse-submodules http://github.com/yesodweb/shakespeare
git clone --recurse-submodules http://github.com/yesodweb/persistent
git clone --recurse-submodules http://github.com/yesodweb/wai
git clone --recurse-submodules http://github.com/yesodweb/yesod
Each repository can be built with stack build.