The PUT request is not sending the whole object

Asked

Viewed 29 times

0

That’s the put I’m giving, (the lower will have the JSON that’s coming from the body):

put(endpoint: string, body: any) {
  return new Promise((resolve, reject) => {
    return this.http.put(this.url + '/' + endpoint, body)
      .subscribe(res => {
          resolve(res.json())
        },
        (error: any) => {
          this.loader.hide();
          this.MessageErroRequest(error);
        });
  });
}

The method is sending like this:

{
  "id": 1,
  "nome": "LESPAUL",
  "validade": 1525568400000,
  "dataGerada": 1525914000000,
  "status": true,
  "itens": [
    []
  ]
}

And the object I’m sending is like this, it just doesn’t go, when I put the BODY it takes the Array "items":

[{
  "id": 1,
  "nome": "LESPAUL",
  "validade": 1525568400000,
  "dataGerada": 1525914000000,
  "status": true,
  "itens": [{
    "cliente": {
      "id": 1,
      "login": "gabriel",
      "senha": "123",
      "tipoDeLogin": 1,
      "telefone": "99916-2410",
      "endereco": "Zetete Tororo 25",
      "nome": "Gabriel Sereno",
      "cpf": "12312312312"
    }
  }]
}]
  • What language is this? Mark the language tag

  • But where doesn’t that come from? No NodeJS? On what server type?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.