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 type allows length longer than 256 chars and length equals to zero #2665

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

Comments

@iariasleon
Copy link
Contributor

iariasleon commented Nov 14, 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: #2659.

update bacth operation request

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

response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: efb46f44-aa56-11e6-ba14-005056a20feb
   Date: Mon, 14 Nov 2016 10:41:44 GMT
payload:

Expected response

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

doc in mongo

{ "_id" : { "id" : "room_3", "type" : "zzSzwDmHxb6FqW1C159MhUvlBFH3mbVhoJ8c7NUzJjBL58smi9cI0Q0HmIEhFxeb3QNRXdJ8uWzu9SGW6SFmmV7WnIXjp76wITnecGAj2NUN0fAK4Io8wvD1kvvWL4KNa2RrF3ayNUGt6aLWvLKaiaML6fF8CEkbGmNtdIWslOUfE7bdc6IiZeYRID5mNZkAD5ssxDmvDfjBZsFscfqvpw3KmCCwUq14zJucjmKSG8ZviFV1FNH46MqlHBk0G6TuN", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "celsius", "creDate" : 1479120104, "modDate" : 1479120104, "value" : "4", "md" : { "alarm" : { "type" : "hot", "value" : "warning" } }, "mdNames" : [ "alarm" ] } }, "creDate" : 1479120104, "modDate" : 1479120104 }

Case 2: length equals to zero

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

update bacth operation request

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

response

http code: 204 - No Content
headers:
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: d53f3c56-ab2e-11e6-be4f-005056a20feb
   Date: Tue, 15 Nov 2016 12:27:11 GMT
payload:

Expected response

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

doc in mongo

{ "_id" : { "id" : "room1", "type" : "Thing", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Number", "creDate" : 1479212831, "modDate" : 1479212831, "value" : 34, "mdNames" : [ ] } }, "creDate" : 1479212831, "modDate" : 1479212831 }
@fgalan fgalan added this to the 1.6.0 milestone Nov 14, 2016
@iariasleon iariasleon changed the title in POST v2/op/update (batch op) entity type allows length longer than 256 chars in POST v2/op/update (batch op) entity type 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