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, if we use an unknown action the op is successful #2653

Closed
iariasleon opened this issue Nov 10, 2016 · 7 comments
Closed
Assignees
Milestone

Comments

@iariasleon
Copy link
Contributor

in POST v2/op/update, if we use an unknown action "actionType": "dfgdf" the op is successfully

update bach operation request

POST localhost:1026/v2/op/update
headers:
    Content-Type: application/json
    Fiware-Service: test_op_update_happy_path
    Fiware-ServicePath: /test
payload: {"entities": [{"type": "house", "temperature": {"value": "34"}, "id": "room1_0"}, {"type": "house", "temperature": {"value": "34"}, "id": "room1_1"}, {"type": "house", "temperature": {"value": "34"}, "id": "room1_2"}, {"type": "house", "temperature": {"value": "34"}, "id": "room1_3"}, {"type": "house", "temperature": {"value": "34"}, "id": "room1_4"}], "actionType": "dfgdf"}

update bach operation response

http code: 204 - No Content
headers:
   Connection: Keep-Alive
   Content-Length: 0
   Fiware-Correlator: 84769862-a766-11e6-98a0-005056a20feb
   Date: Thu, 10 Nov 2016 16:55:43 GMT
payload:

docs in mongo

{ "_id" : { "id" : "room1_0", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1478797236, "modDate" : 1478797236, "value" : "34", "mdNames" : [ ] } }, "creDate" : 1478797236, "modDate" : 1478797236 }
{ "_id" : { "id" : "room1_1", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1478797236, "modDate" : 1478797236, "value" : "34", "mdNames" : [ ] } }, "creDate" : 1478797236, "modDate" : 1478797236 }
{ "_id" : { "id" : "room1_2", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1478797236, "modDate" : 1478797236, "value" : "34", "mdNames" : [ ] } }, "creDate" : 1478797236, "modDate" : 1478797236 }
{ "_id" : { "id" : "room1_3", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1478797236, "modDate" : 1478797236, "value" : "34", "mdNames" : [ ] } }, "creDate" : 1478797236, "modDate" : 1478797236 }
{ "_id" : { "id" : "room1_4", "type" : "house", "servicePath" : "/test" }, "attrNames" : [ "temperature" ], "attrs" : { "temperature" : { "type" : "Text", "creDate" : 1478797236, "modDate" : 1478797236, "value" : "34", "mdNames" : [ ] } }, "creDate" : 1478797236, "modDate" : 1478797236 }

@fgalan fgalan added this to the 1.6.0 milestone Nov 10, 2016
@fgalan
Copy link
Member

fgalan commented Nov 10, 2016

So you mean that wrong actionType is interpreted as APPEND. Is that correct?

@fgalan fgalan added P4 and removed P6 labels Nov 10, 2016
@iariasleon
Copy link
Contributor Author

iariasleon commented Nov 11, 2016

Yes, with wrong actionType, APPEND is the operation assumed . Also con "" (empty), not plain ascii and forbidden chars, returning 204 as http code.

@fgalan
Copy link
Member

fgalan commented Nov 15, 2016

Fixed by PR #2679.

@fgalan
Copy link
Member

fgalan commented Nov 16, 2016

(Reopened, as github automagically closed it)

@fgalan fgalan reopened this Nov 16, 2016
@iariasleon
Copy link
Contributor Author

If the actionType is equals to house"flat", the response is a wrong json, ex:

{"error":"BadRequest","description":"invalid update action type: /house"flat"/"}

tested with the CB version:

  "version" : "1.5.0-next"
  "git_hash" : "1ac05a02f0a1b2a1de88ecc58b452c6139db0b8c"

@kzangeli kzangeli changed the title in POST v2/op/update, if we use an unknown action the op is successfully in POST v2/op/update, if we use an unknown action the op is successful Nov 16, 2016
@fgalan
Copy link
Member

fgalan commented Nov 22, 2016

Fixed in #2700. Ready for re-test @iariasleon , pls.

@iariasleon
Copy link
Contributor Author

LGTM

http code: 400 - Bad Request
headers:
   Connection: Keep-Alive
   Content-Length: 129
   Content-Type: application/json
   Fiware-Correlator: e3b512a8-b0d1-11e6-a22b-005056a20feb
   Date: Tue, 22 Nov 2016 16:36:59 GMT
payload: {"error":"BadRequest","description":"invalid update action type: right ones are: APPEND, APPEND_STRICT, DELETE, REPLACE, UPDATE"}

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