Hi,
we currently use apollo-datasource-rest
, with which it’s possible to pass a body
that is FormData
as a second argument to the post
method of a data source. That’s what we did for file uploads. But with @apollo/datasource-rest
that’s not possible anymore.
Looking at the source code of the fetch
method of both packages, it seems like now everything that is not passing the following conditions (which are present in both) is being ignored:
if (
request.body !== undefined &&
request.body !== null &&
(request.body.constructor === Object ||
Array.isArray(request.body) ||
((request.body as any).toJSON &&
typeof (request.body as any).toJSON === 'function'))
)
With apollo-datasource-rest
a body which fell through that if statement was simply passed on as is. Does someone know what the reasoning behind this is? Maybe in the past we accidentally leveraged a “loophole” in the implementation?