dazzling-sky / COMP4111-project

COMP4111 project - RESTful Web Service for Library Book Management
https://course.cse.ust.hk/comp4111/project.html
0 stars 0 forks source link

[HELP] Unable to commit/cancel a transaction #20

Open Derppening opened 4 years ago

Derppening commented 4 years ago

Issue description

I am unable to commit or cancel an empty transaction. I am unsure whether this is a bug on my side or I am doing something wrong.

Steps to reproduce the issue

Assuming the database is setup according to the README and web server is running:

  1. Login using valid credentials
  2. Request for a transaction
  3. Cancel the transaction

What's the expected result?

What's the actual result?

curl -v -X POST http://localhost:8081/BookManagementService/transaction\?token\=ccu6764                                                                     
*   Trying ::1:8081...
* Connected to localhost (::1) port 8081 (#0)
> POST /BookManagementService/transaction?token=ccu6764 HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.70.0
> Accept: */*
> 
* Mark bundle as not supporting multiuse
< HTTP/1.1 200 OK
< Date: Sun, 31 May 2020 14:47:36 GMT
< Server: Apache-HttpCore-NIO/1.1
< Content-Length: 20
< Content-Type: application/json; charset=UTF-8
< 
* Connection #0 to host localhost left intact
{"Transaction":2058}%                                                                                                                                                                                                                                                            david@david-desktop  ~  curl -v -X POST --data "{\"Transaction\": 2058, \"Operation\": \"cancel\"}" http://localhost:8081/BookManagementService/transaction\?token\=ccu6764
Note: Unnecessary use of -X or --request, POST is already inferred.
*   Trying ::1:8081...
* Connected to localhost (::1) port 8081 (#0)
> POST /BookManagementService/transaction?token=ccu6764 HTTP/1.1
> Host: localhost:8081
> User-Agent: curl/7.70.0
> Accept: */*
> Content-Length: 44
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 44 out of 44 bytes
* Mark bundle as not supporting multiuse
< HTTP/1.1 400 Bad Request
< Date: Sun, 31 May 2020 14:47:43 GMT
< Server: Apache-HttpCore-NIO/1.1
< Content-Length: 0
< Connection: Close
< 
* Closing connection 0
comp4111ta commented 4 years ago

the empty transaction is, of course, valid in the database and our service