curl-runnings-0.17.0: A framework for declaratively writing curl based API tests
Safe HaskellNone
LanguageHaskell2010

Testing.CurlRunnings.Internal.Payload

Description

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

data Payload Source #

Instances

Instances details
Show Payload Source # 
Instance details

Defined in Testing.CurlRunnings.Internal.Payload

Generic Payload Source # 
Instance details

Defined in Testing.CurlRunnings.Internal.Payload

Associated Types

type Rep Payload :: Type -> Type #

Methods

from :: Payload -> Rep Payload x #

to :: Rep Payload x -> Payload #

ToJSON Payload Source # 
Instance details

Defined in Testing.CurlRunnings.Internal.Payload

FromJSON Payload Source # 
Instance details

Defined in Testing.CurlRunnings.Internal.Payload

type Rep Payload Source # 
Instance details

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)))