lundi 26 février 2018

Laravel can not understand formData parameters

According to this question:

Angular5 HttpClient send data but server can not understand its params

I send username, password and _token parameters to server through FormData in angular5. I set header to

'Content-Type': 'application/x-www-form-urlencoded'

now, I faced another problem in server.

Request header changed to

------WebKitFormBoundaryGOu5izF9uMKIXDW1
Content-Disposition: form-data; name:"username"

a@a.com
------WebKitFormBoundaryGOu5izF9uMKIXDW1
Content-Disposition: form-data; name="password"

123456
------WebKitFormBoundaryGOu5izF9uMKIXDW1
Content-Disposition: form-data; name="_token"

[object Object]
------WebKitFormBoundaryGOu5izF9uMKIXDW1--

Now, Laravel could not read request parameters in this way:

$request->input('username')

How could I read request parameters ?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire