简体   繁体   中英

400 (Bad Request) error

Currently from Angular JS controller, I am trying to send the JSON data to backend Service. But I am having 400 Bad Request error.

From Controller, I am trying to send the data via http service like :

shipDataJson.contractNumber=$scope.contractNumber;
             shipDataJson.orderNumber=$scope.orderNumber;
             shipDataJson.shipmentNumber=$scope.shipmentNumber;
             shipDataJson.SCN=$scope.SCN;
             shipDataJson.sourceSystem=$scope.selectedSrcSystem;
             shipDataJson.destinationSystem=$scope.selectedDestSystem;
             shipDataJson.resendFlag='false';

But, Actually at sending time JSON is like:

{
  "contractNumber": "abc",
  "orderNumber": "der",
  "shipmentNumber": "faas",
  "SCN": "fsdafas",
  "sourceSystem": {
    "resendFlag": false,
    "sourceSystem": "arnab"
  },
  "destinationSystem": {
    "resendFlag": false,
    "destinationSystem": "swar"
  },
  "resendFlag": "false"
}

Don't have the idea to remove extra "resendFlag" field from the JSON.

Thanks in advance.

If you want to remove the resendFlag key. Just remove this line : shipDataJson.resendFlag='false';

要从JavaScript对象中删除属性,请delete它们:

delete shipDataJson.destinationSystem.resendFlag

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM