fix(generator): add processData to jQuery ajax for form-urlencoded requests
jQuery default processData:true re-serializes string bodies, causing double-encoding for form-urlencoded payloads. Set processData:false when contentType is application/x-www-form-urlencoded. 🤖 Generated with [Qoder][https://qoder.com]
This commit is contained in:
@@ -1054,6 +1054,7 @@ const defaultDeps = {{
|
||||
type: request.method,
|
||||
data: request.body,
|
||||
contentType: request.headers['Content-Type'],
|
||||
processData: request.headers['Content-Type'] !== 'application/x-www-form-urlencoded',
|
||||
dataType: 'json',
|
||||
success: resolve,
|
||||
error: (xhr, status, err) => reject(new Error(`API failed (${{xhr.status}}): ${{err}}`))
|
||||
@@ -1245,6 +1246,7 @@ const defaultDeps = {{
|
||||
type: request.method,
|
||||
data: request.body,
|
||||
contentType: request.headers['Content-Type'],
|
||||
processData: request.headers['Content-Type'] !== 'application/x-www-form-urlencoded',
|
||||
dataType: 'json',
|
||||
success: resolve,
|
||||
error: (xhr, status, err) => reject(new Error(`API failed (${{xhr.status}}): ${{err}}`))
|
||||
@@ -1377,6 +1379,7 @@ async function ajaxRequest(request) {{
|
||||
type: request.method,
|
||||
data: request.body,
|
||||
contentType: request.headers['Content-Type'],
|
||||
processData: request.headers['Content-Type'] !== 'application/x-www-form-urlencoded',
|
||||
dataType: 'json',
|
||||
success: resolve,
|
||||
error: (xhr, status, err) => reject(new Error(`API failed (${{xhr.status}}): ${{err}}`))
|
||||
|
||||
Reference in New Issue
Block a user