Using usual forms request form for fields #784
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added a new config option called
sendFieldsAsFormValue
that when it'strue
, it changes how the form data is send. The config option was created to ensure backward compatibility.This change helps whoever uses PHP as a Backend, since it's the way PHP understand form fields.
When there's a field that is an array or object, it changes the key, appending each property of the object wrapped in brackets and each key of the array, also wrapped in brackets and making this key equal to the corresponding value at the object/array.
This is a proposal, it's not finished or fully tested.
Examples: Array
The request would be (I'm using query string syntax, but its the
key/value form of multipart/form-data):
Examples: Object
The same works for objects:
The request would be (also like query string):
Examples: Objects inside Array
If the request is an array of multiple objects:
``` javascript`
fields: {
users: [
{ email: 'user1@example.org' },
{ email: 'user2@example.org' }
]
}
users[0][email]=user1@example.org&users[1][email]=user2@example.org