apollo-datasource-http icon indicating copy to clipboard operation
apollo-datasource-http copied to clipboard

FormData body is being coerced to JSON

Open illusionalsagacity opened this issue 2 years ago • 0 comments

on this line, the typeof request.body === 'object' check returns true for FormData from undici and form-data. Resulting in a body of "{}" being sent, with content-type: application/json; charset=utf-8

I think there's a few potential solutions here:

  • Check the content-type, and if it's set, do not attempt to coerce to JSON.
  • Check the json property in Request to be exactly false. This property doesn't appear to be used?
  • Check instanceof FormData from undici, I don't think this is a great option but it's an option.

illusionalsagacity avatar Aug 09 '22 15:08 illusionalsagacity