Advertisement
Guest User

Untitled

a guest
Aug 27th, 2023
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.54 KB | None | 0 0
  1. CURL COMMANDS:
  2. Curl Command: curl -X POST http://localhost:3000/auth/user/user -H "Content-Type: application/json" -H "Authorization: test" -d "{"key": "value"}"
  3. Answer: вечная загрузка
  4.  
  5. curl -X POST http://localhost:3000/auth/user/user -H "Content-Type: application/json" -H "Authorization: test" -d {"key": "value"}
  6. Answer:
  7. \SyntaxError: Unexpected token k in JSON at position 1<br> &nbsp; &nbsp;at JSON.parse (&lt;anonymous&gt;)<br> &nbsp; &nbsp;at parse (D:\AndrewVozniak\laragon\www\WorldPath\application\server\middlewares\Auth\node_modules\body-parser\lib\types\json.js:89:19)<br> &nbsp; &nbsp;at D:\AndrewVozniak\laragon\www\WorldPath\application\server\middlewares\Auth\node_modules\body-parser\lib\read.js:128:18<br> &nbsp; &nbsp;at AsyncResource.runInAsyncScope (node:async_hooks:203:9)<br> &nbsp; &nbsp;at invokeCallback (D:\AndrewVozniak\laragon\www\WorldPath\application\server\middlewares\Auth\node_modules\raw-body\index.js:231:16)<br> &nbsp; &nbsp;at done (D:\AndrewVozniak\laragon\www\WorldPath\application\server\middlewares\Auth\node_modules\raw-body\index.js:220:7)<br> &nbsp; &nbsp;at IncomingMessage.onEnd (D:\AndrewVozniak\laragon\www\WorldPath\application\server\middlewares\Auth\node_modules\raw-body\index.js:280:7)<br> &nbsp; &nbsp;at IncomingMessage.emit (node:events:514:28)<br> &nbsp; &nbsp;at endReadableNT (node:internal/streams/readable:1359:12)<br> &nbsp; &nbsp;at process.processTicksAndRejections (node:internal/process/task_queues:82:21) curl: (3) unmatched close brace/bracket in URL position 6: value}
  8.  
  9. Direct curl command: C:\Users\User>curl -X POST http://127.0.0.1:3008/user -H "Content-Type: application/json" -d "{"key": "value"}"
  10. Answer: {
  11. "token": null,
  12. "user_id": null
  13. }
  14.  
  15. LOGS
  16. Node.js:
  17. Example app listening on port 3000! Making request to http://127.0.0.1:3008/validate_token with token test { token_valid: true, user_id: 1 } Making POST request to Flask: http://127.0.0.1:3008/user { key: 'value' } { authorization: 'test', 'content-type': 'application/json', 'user-agent': 'PostmanRuntime/7.32.3', accept: '*/*', 'postman-token': '92a8f671-6556-42be-9c89-477823852806', 'accept-encoding': 'gzip, deflate, br', connection: 'keep-alive', 'content-length': '24', Userid: 1 }
  18. Flask:
  19. WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead. Running on http://127.0.0.1:3008 Press CTRL+C to quit Restarting with stat Debugger is active! Debugger PIN: 419-929-501 127.0.0.1 - - [27/Aug/2023 23:23:35] "POST /validate_token HTTP/1.1" 200 - Handling POST request
  20.  
  21.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement