I've got an issue that is only happening in my live environment.

I've got the code below in an angular controller:

    $scope.erpTest = function (integrationSettings) {
        $http.get(testUrl(integrationSettings))
            .success(function (data) {
                $.pnotify({
                    title: 'Success',
                    text: 'Connecting to ' + 
integrationSettings.IntegrationName + ' with these settings succeeded 
gloriously!',
                    type: 'success',
                    history: false,
                    before_open: function (pnotify) { pnotify.css({ "top": 
"60px" }); }
                });
            })
            .error(function (data) {
                $.pnotify({
                    title: 'Failed to connect to ' + 
integrationSettings.IntegrationName,
                    text: data,
                    type: 'error',
                    history: false,
                    before_open: function (pnotify) { pnotify.css({ "top": 
"60px" }); }
                });
            });
    }

Basically, it makes a call to some server side functionality that runs some 
tests. On success, it displays an "All OK" message and on error it should 
display an error message (as returned by the server).

In my development environment, this works perfectly. However when I deploy 
to live, success does what it's supposed to but if there is any error (e.g. 
a 401 unauthorized), what I see is in the pnotify dialog is not a simple 
error message ("Unauthorized") but a full HTML page (the page that is 
configured for 401s on the server). 

So in the live environment, an HTML response (rather than a JSON on) 
appears to be returned for all errors :(

I'm not even sure if this has anything to do with angular... but I was 
thinking perhaps the $http.get could be configured to force a JSON response 
rather than an html response (perhaps I could configure a header or 
something)?

Any ideas?

Kind Regards,
James Crosswell

-- 
You received this message because you are subscribed to the Google Groups 
"AngularJS" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/angular.
For more options, visit https://groups.google.com/d/optout.

Reply via email to