Safe Haskell | None |
---|---|
Language | Haskell2010 |
A module defining the Payload type. This is used in specifications to represent request body data. Currently JSON and URLEncoded bodies are supported.
The module provides a FromJSON instance to parse a Payload from a specification.
Payload is parsed from an object containing two keys: bodyType
and
content
.
The value of the bodyType
field must be either json
or
urlencoded
and this indicates how the request data should be encoded.
When bodyType
is `urlencoded ` the value of the content
field must be an
object with string, numeric or boolean values.
When bodyType
is json
the value of the content
field will be used as
the JSON payload.
If bodyType
is not present then the whole object is used as the JSON
payload.
Examples: 1. A URLEncoded request payload:
requestData: bodyType: urlencoded content: key1: value key2: true key3: 10.22
2: A JSON request payload using bodyType
:
requestData: bodyType: json content: key1: value key2: [1,2,3]
3: A JSON request payload without using bodyType
:
requestData: key1: value key2: [1,2,3]
Documentation
Instances
Show Payload Source # | |
Generic Payload Source # | |
ToJSON Payload Source # | |
Defined in Testing.CurlRunnings.Internal.Payload | |
FromJSON Payload Source # | |
type Rep Payload Source # | |
Defined in Testing.CurlRunnings.Internal.Payload type Rep Payload = D1 ('MetaData "Payload" "Testing.CurlRunnings.Internal.Payload" "curl-runnings-0.17.0-NVJ97QtMCJHtl9XbYoan8" 'False) (C1 ('MetaCons "JSON" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Value)) :+: C1 ('MetaCons "URLEncoded" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 KeyValuePairs))) |