Closed
Description
Hi!
On testing #38, I found a subtle bug where ws4sqlite would not be able to process if an empty array is passed. In more details:
# start the server
ws4sqlite --db /tmp/crypta.db
# sending request
curl \
-X POST \
--header 'Content-Type: application/json' \
--data @/tmp/data.json \
--fail-with-body \
127.0.0.1:12321/crypta \
| jq
Where /tmp/data
's content is:
{
"transaction": [
{
"query": "SELECT 1",
"values": []
}
]
}
The response is:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 257 100 156 100 101 420k 272k --:--:-- --:--:-- --:--:-- 250k
curl: (22) The requested URL returned error: 400
{
"reqIdx": -1,
"error": "in parsing body: json: cannot unmarshal array into Go struct field requestItem.transaction.values of type map[string]json.RawMessage"
}
A workaround for this is to change from empty array []
to empty object/dictionary {}
.
I'll see if I can help with this in another PR.
Thanks!
EDIT: this is expected. ws4sqlite
differs from sqliterg
in this regard 😅.
Metadata
Metadata
Assignees
Labels
No labels