вопрос формирования полезной нагрузки запроса метода PUT javascript - PullRequest
0 голосов
/ 21 июня 2019

Я формирую запрос в coffeeScript для обновления существующего значения в базе данных.Я формирую запрос PUT с указанной ниже полезной нагрузкой и получаю bad request error.

. Пожалуйста, найдите мою полезную нагрузку ниже.

{  
   "thresholdValue":[  
      {  
         "businessTypeCode":"PARTS",
         "businessTypeName":"parts",
         "roleName":"System Admin",
         "roleCode":"SYSTM_ADMIN",
         "thresholdValue":"123"
      },
      {  
         "businessTypeCode":"PARTS",
         "businessTypeName":"parts",
         "roleName":"Dealer (Read-only)",
         "roleCode":"DLR_RD_ONLY",
         "thresholdValue":100
      },
      {  
         "businessTypeCode":"PARTS",
         "businessTypeName":"parts",
         "roleName":"Dealer",
         "roleCode":"DLR",
         "thresholdValue":100
      }
    ]
}

userDeactivationThresholdService.coffeeScript

ThresholdValue = $resource('userThresholdValues/update-threshold-value', {},{usage:{method:'PUT'}})

updateThresholdValue: (updatedThresholdValue, onSuccess) ->
   console.log("Update Threshold Values in Service")
   console.log(updatedThresholdValue)
   ThresholdValue.usage({thresholdValue: updatedThresholdValue}, onSuccess)

Пожалуйста, найдите мой файл класса контроллера (coffeeScript)

$scope.saveChanges = ->
    console.log("update threshold values")
    console.log($scope.thresholdValue)
    return if !$scope.userDeactivationThresholdForm.$valid
    $scope.editingInProgress = false
    userDeactivationThresholdService.updateThresholdValue($scope.thresholdValue, thresholdValueUpdatedSuccessfully)

Получаю 400 bad request error.

...