array(
                    'name' => 'message',
                    'type' => 'string',
                    'source' => 'data',
                    'optional' => FALSE,
                ),

When using this argument definition and sending the data with the
Content-Disposition "form-data", the callback gets an empty array
(instead of one holding the 'message' argument) for some operations,
even though the message argument has been set in the sent request.

This only happens for form-data, if you use
"Content-Type: application/x-www-form-urlencoded" instead,
it works just fine.

It also only happens for some operation definitions. For other ones it works.
For a 'working' operation it always works, while for a non-working one it never does.

http://npaste.de/p/Hf/ This is the code in which I encountered the issue.
The message argument works fine with form-data in the 'create'-operation
while it always fails in the 'update'-operation.

I also noted that even though I marked this argument as being non-optional
it doesn't get tested for. This seems to be the case for all arguments with
'source' => 'data'. Shouldn't this be implementable with array_key_exists?

Comments

skyredwang’s picture

Title: REST Server sometimes can't handle data of "Content-Disposition: form-data" (might be a heisenbug) » REST Server cannot parse form-data when the method is PUT
Version: 7.x-3.3 » 7.x-3.5
Issue summary: View changes
Priority: Normal » Major

I can confirm this bug. The form-data works fine for POST, but if the method is PUT, the values passed through aren't parsed (they are empty). Switching to "application/x-www-form-urlencoded" is a workaround.

marcingy’s picture

Priority: Major » Normal

This is not a major bug

kylebrowning’s picture

but how do we fix it :(

kylebrowning’s picture

Status: Active » Closed (won't fix)

Cleaning issue queue. If someone wishes to work on this, let me know by reopening this ticket.