@ -223,12 +223,14 @@ preparePayload = (request, response, requestState) ->
if ( request . options . encodeJSON or request . options . formFields ? ) and not multipart
# We know the payload and its size in advance .
debugRequest " got url-encodable form-data "
request . options . headers [ " content-type " ] = " application/x-www-form-urlencoded "
if request . options . encodeJSON
debugRequest " ... but encodeJSON was set, so we will send JSON instead "
request . options . headers [ " content-type " ] = " application/json "
request.payload = JSON . stringify request . options . formFields ? null
else if not _ . isEmpty request . options . formFields
# The ` querystring ` module copies the key name verbatim , even if the value is actually an array . Things like PHP don ' t understand this, and expect every array-containing key to be suffixed with []. We ' ll just append that ourselves , then .
request . options . headers [ " content-type " ] = " application/x-www-form-urlencoded "
request.payload = querystring . stringify formFixArray ( request . options . formFields )
else
request.payload = " "