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

Response config is not present. #1460

Open
olysyuk opened this issue Jan 28, 2017 · 1 comment
Open

Response config is not present. #1460

olysyuk opened this issue Jan 28, 2017 · 1 comment

Comments

@olysyuk
Copy link

olysyuk commented Jan 28, 2017

I'm trying to make custom post on entity action (POST /environment/9/validated)

The code calling restangular is the following:

Restangular.one('website', $routeParams.websiteId).one('environment', environment.id)
                .customPOST({}, 'validate').then(function(data) {
                    console.log(data);
                });

Back-end returns 400 as a validation error that is shown in console

angular.js:12410 POST http://localhost:9001/api/v1/website/21/environment/9/validate 400 (Bad Request)

But then okCallback has no config for response:

TypeError: Cannot read property 'params' of undefined
    at okCallback (http://localhost:9001/app/bower_components/restangular/dist/restangular.js:1249:45)
    at processQueue (http://localhost:9001/app/bower_components/angular/angular.js:16648:37)
    at http://localhost:9001/app/bower_components/angular/angular.js:16692:27
    at Scope.$eval (http://localhost:9001/app/bower_components/angular/angular.js:17972:28)
    at Scope.$digest (http://localhost:9001/app/bower_components/angular/angular.js:17786:31)
    at Scope.$apply (http://localhost:9001/app/bower_components/angular/angular.js:18080:24)
    at done (http://localhost:9001/app/bower_components/angular/angular.js:12210:47)
    at completeRequest (http://localhost:9001/app/bower_components/angular/angular.js:12436:7)
    at XMLHttpRequest.requestLoaded (http://localhost:9001/app/bower_components/angular/angular.js:12364:9) Possibly unhandled rejection: {}

Line that assigns callback has number 1322 .
Restangular version 1.6.1

@olysyuk
Copy link
Author

olysyuk commented Jan 28, 2017

It turns out that this happens if response is a malformed json. Feel free to close this issue if you think that lib behavior is correct.

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

1 participant