kostysh / File-uploading-component-for-Sencha-Touch

Ext.Button based component for uploading files in Sencha Touch apps without page refresh
51 stars 26 forks source link

File Uploader fails on anything but a Http 200 response #12

Closed jonswaino closed 10 years ago

jonswaino commented 10 years ago

I have a ASP.NET WebAPI controller which returns a HTTP Created (201) which is treated as a failure by the component. Shouldn't it view a 201 as a success? It might be worth treating all Http 200+ codes as success rather than failures. What do you think?

kostysh commented 10 years ago

I think - HTTP Created (201) - not a standard response for most cases. For your case you can change line: 438

jonswaino commented 10 years ago

Ok thanks, I'll leave it to you to decide whether you want to change your code or not. I'll still make my change on my own local copy.

kostysh commented 10 years ago

Just updated component repository. New feature for you: configurable success response codes Now you can configure your default codes by setDefaultSuccessCodes([200,201]) I think this is will be universal solution for all cases.

K.

On Thu, Jun 13, 2013 at 9:36 PM, jonswaino notifications@github.com wrote:

Ok thanks, I'll leave it to you to decide whether you want to change your code or not. I'll still make my change on my own local copy.

— Reply to this email directly or view it on GitHubhttps://github.com/kostysh/File-uploading-component-for-Sencha-Touch/issues/12#issuecomment-19414587 .

talhakabakus commented 10 years ago

Thanks for this useful extension, appreciated a lot. I've been facing same issue, just found solution after dig inside your code. At line 455, HTTP response code control should be changed like this to properly search response code inside default success codes: if(Ext.Array.indexOf(me.getDefaultSuccessCodes(), parseInt(this.status)) != -1)

kostysh commented 10 years ago

Thank you for advice! Not noticed this simple issue Just fixed. Thanks!

On Mon, Jul 15, 2013 at 11:39 AM, Talha Kabakuş notifications@github.comwrote:

Thanks for this useful extension, appreciated a lot. I've been facing same issue, just found solution after dig inside your code. At line 455, HTTP response code control should be changed like this to properly search response code inside default success codes: if(Ext.Array.indexOf(me.getDefaultSuccessCodes(), parseInt(this.status)) != -1)

— Reply to this email directly or view it on GitHubhttps://github.com/kostysh/File-uploading-component-for-Sencha-Touch/issues/12#issuecomment-20957437 .