SWI-Prolog / pengines

Pengine and Prolog scratchpad
BSD 2-Clause "Simplified" License
56 stars 16 forks source link

Oddity with JSON response to next #17

Open Anniepoo opened 8 years ago

Anniepoo commented 8 years ago

I'm sending next events as x-prolog with body

next

and getting back this strange beastie when it goes to destroy:

{
  "data": {
    "data": [{"X": "c"}],
    "event": "success",
    "id": "4c53430f-9570-4e05-9036f6b5fc63dd8c",
    "more": false,
    "time": 3.951999999999992e-05
  },
  "event": "destroy",
  "id": "4c53430f-9570-4e05-9036-f6b5fc63dd8c"
}

I'd count this as an oddity.

JanWielemaker commented 8 years ago

This is fine. Create and destroy events may embed the first and last answer. The first happens if you include the ask option in the create and the latter if auto destruction is enabled (default). Both can be combined, which may give you a single response that consists of a create, embedded destroy and embedded first-and-only answer. This is done to reduce round trips.

Anniepoo commented 8 years ago

I understand why its dine, its the field naming - data field with data field - that is odd