mirror of
https://github.com/dillonkearns/elm-pages-v3-beta.git
synced 2024-11-25 09:21:57 +03:00
Add expectBody.
This commit is contained in:
parent
661c84467b
commit
3e4643f598
@ -9,8 +9,9 @@ module Server.Request exposing
|
||||
, expectQueryParam
|
||||
, cookie, expectCookie
|
||||
, expectHeader
|
||||
, expectFormPost
|
||||
, File, expectMultiPartFormPost
|
||||
, expectBody
|
||||
, expectFormPost
|
||||
, map3, map4, map5, map6, map7, map8, map9
|
||||
, errorsToString, errorToString, getDecoder, ValidationError
|
||||
)
|
||||
@ -53,16 +54,17 @@ module Server.Request exposing
|
||||
@docs expectHeader
|
||||
|
||||
|
||||
## Form Posts
|
||||
|
||||
@docs expectFormPost
|
||||
|
||||
|
||||
## Multi-part forms and file uploads
|
||||
|
||||
@docs File, expectMultiPartFormPost
|
||||
|
||||
|
||||
## Request Parsers That Can Fail
|
||||
|
||||
@docs expectBody
|
||||
@docs expectFormPost
|
||||
|
||||
|
||||
## Map Functions
|
||||
|
||||
@docs map3, map4, map5, map6, map7, map8, map9
|
||||
@ -999,6 +1001,17 @@ rawBody =
|
||||
|> 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
|
||||
= Connect
|
||||
|
Loading…
Reference in New Issue
Block a user