Dear Christian and Nico,

To follow-up on that JSON issue: I think I'm having some trouble with that
one.

As Nico suggested, I directly switched my serialization to put the map
variable as parameter to 'http:send-request' (a map previously created with
map:merge in my code).

But I have the following errors:
* When I don't serialize and directly send the map, I get an "*Atomic item
required, function item found*" error at request time.
* When I *do* serialize it, like I did (with success) in BaseX 9, I
get an "*Invalid
json message received*" error at request time.
The API I query hasn't changed since my BaseX update, and that code was
working fine before, so the data I send most likely isn't the problem here.
I tried printing the map that is sent/serialized and it's perfectly valid
JSON.

How can I solve this problem?

Thanks

Remy




Le mer. 20 nov. 2024 à 09:14, Christian Grün <christian.gr...@gmail.com> a
écrit :

> Thanks for pointing this out, Nico. This one should have been documented
> indeed, or changed with the next major release.
>
>
>
> Nico Verwer (Rakensi) <nver...@rakensi.com> schrieb am Mi., 20. Nov.
> 2024, 08:46:
>
>> Dear Rémy,
>>
>> A particular change in BaseX 11.4 that took me a while to find, is a
>> change in http:send-request. So this is only relevant if you use that
>> function.
>> If you send a JSON body, previously you had to serialize it, like:
>>
>>        http:send-request(
>>          <http:request method='put'>
>>            <http:body media-type='application/json'/>
>>          </http:request>,
>>          $url,
>>          serialize($body-map, map{'method':'json'})
>>        )
>>
>> This has changed, and the right way to call this is now:
>>
>>        http:send-request(
>>          <http:request method='put'>
>>            <http:body media-type='application/json'/>
>>          </http:request>,
>>          $url,
>>          $body-map
>>        )
>>
>> If you use http:send-request, I hope this will save you a bit of time.
>>
>> Best regards,
>> Nico Verwer
>>
>

Reply via email to