You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am encountering an issue where scalar values in my request body are being wrapped in lists when using the get_message_body() function from the RAPIClient library. This behavior results in a 400 Bad Request error from the API endpoint, as it expects scalar values but receives lists instead.
The problem seems to stem from how get_message_body() handles the serialization of data. Even when scalar values are provided, they are being converted into lists, which causes issues with the API’s expected input format.
It seems that the get_message_body() function may be handling scalar values as list. From what I understand, the auto_unbox option could be involved in this behavior, causing scalar values to be unnecessarily wrapped in lists.
Is there a way to ensure that scalar values are not wrapped in lists during the request body preparation? Cheers
The text was updated successfully, but these errors were encountered:
Try adding auto_unbox = TRUE to your get_operations() call. The add a pet example on readme.Rmd throws a 500 for a similar reason. It worked locally when I changed it to operations <- get_operations(pet_api, auto_unbox = TRUE)
Do the operations$addPet() call inside httr::with_verbose({}) as shown for the get and delete pet to see the difference in post bodies.
BTW it probably should be opened as a separate issue but httr says it's superseded by httr2.
I am encountering an issue where scalar values in my request body are being wrapped in lists when using the
get_message_body()
function from the RAPIClient library. This behavior results in a400 Bad Request
error from the API endpoint, as it expects scalar values but receives lists instead.The problem seems to stem from how
get_message_body()
handles the serialization of data. Even when scalar values are provided, they are being converted into lists, which causes issues with the API’s expected input format.Steps to Reproduce:
Here's a simple demo to reproduce the issue:
Actual Behavior:
The scalar values are being wrapped in lists, resulting in the following incorrect request body:
It seems that the
get_message_body()
function may be handling scalar values as list. From what I understand, theauto_unbox
option could be involved in this behavior, causing scalar values to be unnecessarily wrapped in lists.Is there a way to ensure that scalar values are not wrapped in lists during the request body preparation? Cheers
The text was updated successfully, but these errors were encountered: