1
resposta

Comando Curl aula 2 primeiro video aula

Olá, Pq será que meu não está correspondente ao retorno da video aula:

λ curl http://localhost:3000/pagamentos/pagamento -X POST -v -H "Content-type: application/json" -d '{ "forma_de_pagamento":"payfast", "valor":10.98, "moeda":"BRL", "descricao":"criando um pagamento" }'; echo Note: Unnecessary use of -X or --request, POST is already inferred.

  • Trying ::1...
  • TCP_NODELAY set
  • Connected to localhost (::1) port 3000 (#0)

    POST /pagamentos/pagamento HTTP/1.1 Host: localhost:3000 User-Agent: curl/7.55.1 Accept: / Content-type: application/json Content-Length: 2

  • upload completely sent off: 2 out of 2 bytes < HTTP/1.1 400 Bad Request < X-Powered-By: Express < Content-Security-Policy: default-src 'none' < X-Content-Type-Options: nosniff < Content-Type: text/html; charset=utf-8 < Content-Length: 1136 < Date: Thu, 22 Oct 2020 22:16:18 GMT < Connection: keep-alive < Keep-Alive: timeout=5 <
SyntaxError: Unexpected token ' in JSON at position 0    at JSON.parse (<anonymous>)    at createStrictSyntaxError (C:\Users\junio\Projeto\Node_js\payfast\node_modules\body-Parser\lib\types\json.js:158:10)    at parse (C:\Users\junio\Projeto\Node_js\payfast\node_modules\body-Parser\lib\types\json.js:83:15)    at C:\Users\junio\Projeto\Node_js\payfast\node_modules\body-Parser\lib\read.js:121:18    at invokeCallback (C:\Users\junio\Projeto\Node_js\payfast\node_modules\raw-body\index.js:224:16)    at done (C:\Users\junio\Projeto\Node_js\payfast\node_modules\raw-body\index.js:213:7)    at IncomingMessage.onEnd (C:\Users\junio\Projeto\Node_js\payfast\node_modules\raw-body\index.js:273:7)    at IncomingMessage.emit (events.js:314:20)    at endReadableNT (_stream_readable.js:1223:12)    at processTicksAndRejections (internal/process/task_queues.js:84:21)
  • Connection #0 to host localhost left intact Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: forma_de_pagamento:payfast,/
  • Port number ended with 'p'
  • Closing connection -1 curl: (3) Port number ended with 'p' Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: valor:10.98,/
  • Port number ended with '.'
  • Closing connection -1 curl: (3) Port number ended with '.' Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: moeda:BRL,/
  • Port number ended with 'B'
  • Closing connection -1 curl: (3) Port number ended with 'B' Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: descricao:criando um pagamento/
  • Port number ended with 'c'
  • Closing connection -1 curl: (3) Port number ended with 'c' curl: (3) [globbing] unmatched close brace/bracket in column 1 Note: Unnecessary use of -X or --request, POST is already inferred.
  • Rebuilt URL to: echo/
  • Could not resolve host: echo
  • Closing connection 1 curl: (6) Could not resolve host: echo
1 resposta

Oi, Junior, tudo bem?

Para te ajudar, você poderia compartilhar o seu código do pagamento.js para que possa entender melhor porque no seu o comportamento foi diferente.