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

Using angular interceptors in uploader request #434

Open
mort3za opened this Issue Jun 14, 2015 · 12 comments

Comments

Projects
None yet
@mort3za

mort3za commented Jun 14, 2015

Is there a way to add custom interceptors to the uploader plugin requests? I added a interceptor to all my requests but it didn't apply on requests of this plugin. Any help will be appreciated.

@nervgh nervgh added the enhancement label Jun 23, 2015

@nervgh nervgh added this to the 2.0.0 milestone Jun 23, 2015

@nervgh

This comment has been minimized.

Owner

nervgh commented Jun 23, 2015

Current version is not support this.

@aosi87

This comment has been minimized.

aosi87 commented Jul 7, 2015

if you use ngResource when you create your $resource handler (angular factory) you can overwrite some methods, even so create functions inject queries if am not mistaken, you can use $q, $http callbacks to do what you want too, im a bit new on interceptors but thats the way im doing it right now. Cheers.

@bitbay

This comment has been minimized.

bitbay commented Oct 12, 2015

I have problems with dropzone exactly because of this - my interceptor (that check for "expired session" errors and automatically tries to refresh the session and repeats the previously failed request, in this case, the file upload) doesn't act on the upload fail because dropzone (being a jquery plugin) uses native browser XMLHttpRequest, just like angular-file-upload does.
The solution would be using angulars $http service to do the uploading (and while we are at it, maybe mix-in promises).

The $http service is a core Angular service that facilitates communication with the remote HTTP servers via the browser's XMLHttpRequest object or via JSONP.

The $httpProvider.interceptors can only keep track of XMLHttpRequest instances wrapped by the $http service - hence while using new XMLHttpRequests (outside of angular) it won't be able to act on them.

I was wondering if uploading images through $http is technically impossible, or if this is just a major design flaw in this library...

Looks feature-full and promising though, thanks to all the contributors for Your hard work!

@chris-verclytte

This comment has been minimized.

chris-verclytte commented Oct 27, 2015

+1 ! It would be really great to be able to use interceptors.

@nick-allen

This comment has been minimized.

nick-allen commented May 18, 2016

+1

5 similar comments
@Aetherus

This comment has been minimized.

Aetherus commented Oct 11, 2016

+1

@felixbillon

This comment has been minimized.

felixbillon commented Oct 13, 2016

+1

@thmarti

This comment has been minimized.

thmarti commented Feb 9, 2017

+1

@bnbarak

This comment has been minimized.

bnbarak commented Feb 28, 2017

+1

@FrontPsych

This comment has been minimized.

FrontPsych commented Mar 31, 2017

+1

@mrgoos

This comment has been minimized.

mrgoos commented Jun 4, 2017

+1

@theo4u theo4u self-assigned this Jun 4, 2017

@souzara

This comment has been minimized.

souzara commented Oct 5, 2017

It can help you...at moment, alright?
capturar

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment