-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Accept request header always set to 'text/*' when reverting to FileApi #121
Comments
Add below lines here https://github.com/danialfarid/angular-file-upload/blob/master/dist/angular-file-upload-shim.js#L113
If that works I do a fix release tomorrow. |
Hey Danial - thanks a lot for the quick response but all my code is at work and I'm home for the weekend now so won't be able to try again until Monday (Australian timezone). I will definitely give it a go and feedback although I did a bit of searching on the train ride home and after looking at the flash API http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/flash/net/FileReference.html#upload() and other comments on FileAPI https://github.com/mailru/FileAPI/issues/59 I don't hold out much hope. I think the Flash API itself is too inflexible to allow it. I'll let you know how I get on after the weekend. |
Yea you are right it doesn't work. |
Hmm ok - looks like you have proven it won't work :-( I'll look at fudging the backend to allow 'text/*' for JSON. Thanks for checking this out though! |
No easy solution or alternative for this and there are server workarounds for this issue. |
When using the plugin with a HTML5 compatible browser it produces a request with the Accept request header as 'application/json', however the FileApi (flash) code always produces an Accept header of 'text/*'.
I can't find a way to override this and this causes issues with Java server-side code.
Any workarounds in the mean time would be greatly appreciated.
The following have been tried and have no effect:
Setting headers in $upload:
$upload.upload({headers: {accept:'application/json',....}})
Editing angular-file-upload-shim.js and forcing header config
// Hack to try to force headers to be passed to FileAPI
config.headers = {'Accept': 'application/json'};
// Existing line below
xhr.__fileApiXHR = FileAPI.upload(config);
After making each of the above changes and sniffing the traffic, the Accept header was still 'text/*'
The text was updated successfully, but these errors were encountered: