javascript - How do I avoid the error event in fine uploader when there is no response content on a successful upload? -
i've configured fineuploader use cors , work amazon web services s3 bucket.
the problem face, successful upload not return response content (status code 204 though, response content empty). though upload happens (i've verified file uploaded), error event triggered. presumably, because there no response.
how handle case? there way me manually trigger 'success' catching error in 'onerror' callback?
edit:
i've made progress digging here. error seems stem handler.xhr.js
.
in particular, inside parseresponse(xhr)
function.
try{ response = qq.parsejson(xhr.responsetext); } catch(error) { log('error when attempting parse xhr response text (' + error + ')', 'error'); response = {}; }
this seems throw error since response empty.
does know proper response should be? i'm thinking of adding line here checking empty response , manually plugging in correct response should be.
the issue parseresponse()
function after all. expects successful uploads return json string {"success": true}
after successful upload.
in case, amazon returns empty response 204 status code. 204 status code implies no response needed.
i've fixed in case modifying section mentioned in edit follows:
try { if(xhr.status == 204 && xhr.responsetext.length == 0){ response = qq.parsejson('{"success": true}'); } else{ response = qq.parsejson(xhr.responsetext); } }
hopefully others run issue in future.
Comments
Post a Comment