mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-28 23:12:22 +03:00
Add expectBody.
This commit is contained in:
parent
661c84467b
commit
3e4643f598
@ -9,8 +9,9 @@ module Server.Request exposing
|
|||||||
, expectQueryParam
|
, expectQueryParam
|
||||||
, cookie, expectCookie
|
, cookie, expectCookie
|
||||||
, expectHeader
|
, expectHeader
|
||||||
, expectFormPost
|
|
||||||
, File, expectMultiPartFormPost
|
, File, expectMultiPartFormPost
|
||||||
|
, expectBody
|
||||||
|
, expectFormPost
|
||||||
, map3, map4, map5, map6, map7, map8, map9
|
, map3, map4, map5, map6, map7, map8, map9
|
||||||
, errorsToString, errorToString, getDecoder, ValidationError
|
, errorsToString, errorToString, getDecoder, ValidationError
|
||||||
)
|
)
|
||||||
@ -53,16 +54,17 @@ module Server.Request exposing
|
|||||||
@docs expectHeader
|
@docs expectHeader
|
||||||
|
|
||||||
|
|
||||||
## Form Posts
|
|
||||||
|
|
||||||
@docs expectFormPost
|
|
||||||
|
|
||||||
|
|
||||||
## Multi-part forms and file uploads
|
## Multi-part forms and file uploads
|
||||||
|
|
||||||
@docs File, expectMultiPartFormPost
|
@docs File, expectMultiPartFormPost
|
||||||
|
|
||||||
|
|
||||||
|
## Request Parsers That Can Fail
|
||||||
|
|
||||||
|
@docs expectBody
|
||||||
|
@docs expectFormPost
|
||||||
|
|
||||||
|
|
||||||
## Map Functions
|
## Map Functions
|
||||||
|
|
||||||
@docs map3, map4, map5, map6, map7, map8, map9
|
@docs map3, map4, map5, map6, map7, map8, map9
|
||||||
@ -999,6 +1001,17 @@ rawBody =
|
|||||||
|> Parser
|
|> Parser
|
||||||
|
|
||||||
|
|
||||||
|
{-| Same as [`rawBody`](#rawBody), but will only match when a body is present in the HTTP request.
|
||||||
|
-}
|
||||||
|
expectBody : Parser String
|
||||||
|
expectBody =
|
||||||
|
rawBody
|
||||||
|
|> andThen
|
||||||
|
(Result.fromMaybe "Expected body but none was present."
|
||||||
|
>> fromResult
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
{-| -}
|
{-| -}
|
||||||
type Method
|
type Method
|
||||||
= Connect
|
= Connect
|
||||||
|
Loading…
Reference in New Issue
Block a user