mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Rename Request.cookies -> allCookies. Add map5.
This commit is contained in:
parent
8b0e78157b
commit
a93a530439
@ -66,7 +66,7 @@ requestPrinter =
|
|||||||
)
|
)
|
||||||
Request.rawBody
|
Request.rawBody
|
||||||
Request.method
|
Request.method
|
||||||
Request.cookies
|
Request.allCookies
|
||||||
Request.queryParams
|
Request.queryParams
|
||||||
)
|
)
|
||||||
|> ApiRoute.literal "api"
|
|> ApiRoute.literal "api"
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
module Server.Request exposing
|
module Server.Request exposing
|
||||||
( Parser
|
( Parser
|
||||||
, method, rawBody, cookies, queryParams
|
, method, rawBody, allCookies, rawHeaders, queryParams
|
||||||
, Method(..), methodToString
|
, Method(..), methodToString
|
||||||
, succeed, fromResult, skip, validationError
|
, succeed, fromResult, skip, validationError
|
||||||
, requestTime, optionalHeader, expectContentType, expectJsonBody, jsonBodyResult
|
, requestTime, optionalHeader, expectContentType, expectJsonBody, jsonBodyResult
|
||||||
@ -11,7 +11,7 @@ module Server.Request exposing
|
|||||||
, expectHeader
|
, expectHeader
|
||||||
, expectFormPost
|
, expectFormPost
|
||||||
, File, expectMultiPartFormPost
|
, File, expectMultiPartFormPost
|
||||||
, map3, map4
|
, map3, map4, map5
|
||||||
, errorsToString, errorToString, getDecoder, ValidationError
|
, errorsToString, errorToString, getDecoder, ValidationError
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -22,7 +22,7 @@ module Server.Request exposing
|
|||||||
|
|
||||||
## Direct Values
|
## Direct Values
|
||||||
|
|
||||||
@docs method, rawBody, cookies, queryParams
|
@docs method, rawBody, allCookies, rawHeaders, queryParams
|
||||||
|
|
||||||
@docs Method, methodToString
|
@docs Method, methodToString
|
||||||
|
|
||||||
@ -65,7 +65,7 @@ module Server.Request exposing
|
|||||||
|
|
||||||
## Map Functions
|
## Map Functions
|
||||||
|
|
||||||
@docs map3, map4
|
@docs map3, map4, map5
|
||||||
|
|
||||||
|
|
||||||
## Internals
|
## Internals
|
||||||
@ -395,6 +395,24 @@ map4 combineFn request1 request2 request3 request4 =
|
|||||||
|> map2 (|>) request4
|
|> map2 (|>) request4
|
||||||
|
|
||||||
|
|
||||||
|
{-| -}
|
||||||
|
map5 :
|
||||||
|
(value1 -> value2 -> value3 -> value4 -> value5 -> valueCombined)
|
||||||
|
-> Parser value1
|
||||||
|
-> Parser value2
|
||||||
|
-> Parser value3
|
||||||
|
-> Parser value4
|
||||||
|
-> Parser value5
|
||||||
|
-> Parser valueCombined
|
||||||
|
map5 combineFn request1 request2 request3 request4 request5 =
|
||||||
|
succeed combineFn
|
||||||
|
|> map2 (|>) request1
|
||||||
|
|> map2 (|>) request2
|
||||||
|
|> map2 (|>) request3
|
||||||
|
|> map2 (|>) request4
|
||||||
|
|> map2 (|>) request5
|
||||||
|
|
||||||
|
|
||||||
optionalField : String -> Json.Decode.Decoder a -> Json.Decode.Decoder (Maybe a)
|
optionalField : String -> Json.Decode.Decoder a -> Json.Decode.Decoder (Maybe a)
|
||||||
optionalField fieldName decoder_ =
|
optionalField fieldName decoder_ =
|
||||||
let
|
let
|
||||||
@ -450,6 +468,14 @@ expectHeader headerName =
|
|||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
{-| -}
|
||||||
|
rawHeaders : Parser (Dict String String)
|
||||||
|
rawHeaders =
|
||||||
|
Json.Decode.field "headers" (Json.Decode.dict Json.Decode.string)
|
||||||
|
|> noErrors
|
||||||
|
|> Parser
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
requestTime : Parser Time.Posix
|
requestTime : Parser Time.Posix
|
||||||
requestTime =
|
requestTime =
|
||||||
@ -642,13 +668,13 @@ expectCookie name =
|
|||||||
{-| -}
|
{-| -}
|
||||||
cookie : String -> Parser (Maybe String)
|
cookie : String -> Parser (Maybe String)
|
||||||
cookie name =
|
cookie name =
|
||||||
cookies
|
allCookies
|
||||||
|> map (Dict.get name)
|
|> map (Dict.get name)
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
cookies : Parser (Dict String String)
|
allCookies : Parser (Dict String String)
|
||||||
cookies =
|
allCookies =
|
||||||
Json.Decode.field "headers"
|
Json.Decode.field "headers"
|
||||||
(optionalField "cookie"
|
(optionalField "cookie"
|
||||||
Json.Decode.string
|
Json.Decode.string
|
||||||
|
Loading…
Reference in New Issue
Block a user