Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File sync uses to 'PUT' method instead of 'POST' in latest version? #18

Open
hhandoko opened this issue Nov 18, 2013 · 2 comments
Open

Comments

@hhandoko
Copy link

I've updated the widget to the latest version (the most recent 'master' commit), but I noticed that the store sync method (when 'Upload' button is clicked) uses 'PUT' which causes the method to fail / behave erratically (e.g. web server may respond with a 500 or a 405, or just fail silently).

Unfortunately I can't seem to locate the particular change in the source (through comparing the latest version that I have vs the latest version).

@ivan-novakov
Copy link
Owner

I'm not sure I get this - your problem is that the widget uses the PUT method and the server doesn't support it? I think that the PUT method was default before the update also. Anyway, it is possible to set alternative method like POST.

I'm not sure which method should be default. The difference between POST and PUT is IMHO in immutability - PUT is immutable, POST is not.

@hhandoko
Copy link
Author

That's strange, I haven't done any special configuration using the previous version, and it defaults to POST. The reason I noticed, is that after upgrading, the server started returning 404's as I haven't defined a PUT endpoint. I've updated the server-side methods to PUT but the behaviour is erratic.

How would I set the default method to POST? Do I need to specify the uploader specifically and pass on the options?

Here's what I have currently.

var dialog = Ext.create('Ext.ux.upload.Dialog', {
    dialogTitle: 'File Upload',
    uploadUrl: Ext.String.format('shipments/{0}/attachments', shipmentCode)
});

if (!dialog.hasListener('beforeclose')) {
    dialog.addListener('beforeclose', this.load);
}

dialog.show();

PS: At the moment I use POST for create and PUT for update operations. But, thanks for the tip about POST vs PUT, there's certainly a lot of differing opinion about REST verb usages and I'll need to do a bit more research.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants