AXIOS implements the object OBJ data to Formdata when the POST request is requested

  • 的头像-Tumi
  • 44 day agopublish

Today, when I update the registration information, use AXIOS’s POST request, send data,

axios 实现post请求时把对象obj数据转为formdata

, but the parameter error is displayed, but when viewing Header, It is actually an object:

This can not, but will think about how to get objects into FORMDATA, just join the two codes, axios 实现post请求时把对象obj数据转为formdata

TRANSFORMREQUEST: [Function (DATA) {let Ret = ‘FOR (Let IT IN DATA) {RET + = Encodeuricomponent (IT) +’ = ‘+ Encodeuricomponent (DATA [IT]) + ‘&’} return RET}], Headers: {‘content-type’: ‘Application / X-www-form-urlencoded’}
   Add inside the request 
When the header is viewed, it is successful,

axios 实现post请求时把对象obj数据转为formdata

The above AXIOS implements POST request Turn the object OBJ data to Formdata is all the contents of Xiaobian sharing to everyone, I hope I can give you a reference, I hope everyone will support Tumi Cloud.

© Copyright Notice
THE END
Just support it if you like
like0
share
comment Grab the couch

Please log in to comment