Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in POST v2/op/update (batch op) entity id allows length longer than 256 chars and length equals to zero #2659

Closed
iariasleon opened this issue Nov 11, 2016 · 2 comments

Comments

@iariasleon
Copy link
Contributor

iariasleon commented Nov 11, 2016

Case 1: length longer than 256 chars

in POST v2/op/update (batch op) entity id allows length longer than 256 chars. See similar issue: #2665

update bacth operation request

`url: POST http://localhost:1026/v2/op/update
headers:
    Content-Type: application/json
    Fiware-Service: test_op_update_entitiies_id_error
    Fiware-ServicePath: /test
payload: {"entities": [{"type": "house", "temperature": {"type": "celsius", "value": "4", "metadata": {"alarm": {"type": "hot", "value": "warning"}}}, "id": "OcwFMyjqjYYw1j0RcxSiDIsIyApJd3Y3xXL1iJAWaRDgEC4ROzdJZcemVmwC6AGoCOT6X1WM7rssozuyUwRztQMMcac1qma63zRRu0UoNJXNH58DlN6Sy1164IXmo1SY0iZ7ZeW1L3q0dOPjCXcWd5JTf12kDySRvketTkl9WVe7fv5Smabe92ySYfdNiY7hegeafcOEcTQwdtjhV2jsnRUUkLqH8o4Mny8xzgxCt65NuiAP5eIfkafWjmVSSHBKE"}], "actionType": "APPEND"}

response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: 05b766c2-a81b-11e6-a5db-005056a20feb
   Date: Fri, 11 Nov 2016 14:27:49 GMT
payload:

Expected response

http code: 400 - Bad Request
{"error":"BadRequest","description":"entity id length: 257, max length supported: 256"}

doc in mongo

`{ "_id" : { "id" : "OcwFMyjqjYYw1j0RcxSiDIsIyApJd3Y3xXL1iJAWaRDgEC4ROzdJZcemVmwC6AGoCOT6X1WM7rssozuyUwRztQMMcac1qma63zRRu0UoNJXNH58DlN6Sy1164IXmo1SY0iZ7ZeW1L3q0dOPjCXcWd5JTf12kDySRvketTkl9WVe7fv5Smabe92ySYfdNiY7hegeafcOEcTQwdtjhV2jsnRUUkLqH8o4Mny8xzgxCt65NuiAP5eIfkafWjmVSSHBKE", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1478874469, "modDate" : 1478874469, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1478874469, "modDate" : 1478874469 }

Case 2: length equals to zero

in POST v2/op/update (batch op) entity id allows length equals to zero. See similar issue: #2665

update bacth operation request

`url: POST http://localhost:1026/v2/op/update
headers:
    Content-Type: application/json
    Fiware-Service: test_op_update_entitiies_id_error
    Fiware-ServicePath: /test
payload:  {"actionType": "APPEND", "entities": [ {"type": "house", "id": "",  "temperature":{"value": 34}}]}

response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: 98a69f1a-ab2d-11e6-bee2-005056a20feb
   Date: Tue, 15 Nov 2016 12:18:20 GMT

Expected response

http code: 400 - Bad Request
{"error":"BadRequest","description":"entities id is empty"}

doc in mongo

{ "_id" : { "id" : "", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Number", "creDate" : 1479212642, "modDate" : 1479212642, "value" : 34, "mdNames" : [ ] } }, "creDate" : 1479212642, "modDate" : 1479212642 }
@fgalan fgalan added this to the 1.6.0 milestone Nov 11, 2016
@iariasleon iariasleon changed the title in POST v2/op/update (batch op) entity id allows length longer than 256 chars in POST v2/op/update (batch op) entity id allows length longer than 256 chars and length equals to zero Nov 15, 2016
@fgalan
Copy link
Member

fgalan commented Nov 15, 2016

Fixed by PR #2679.

@iariasleon
Copy link
Contributor Author

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants