Skip to content

Response config is not present. #1460

Open

Description

@olysyuk

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

Activity

  1. olysyuk commented on Jan 28, 2017

    @olysyuk
    Author

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions