Skip to content

Bun compatibility #439

@chriscdn

Description

@chriscdn

Describe the feature

I tried ofetch with Bun. It seems to work, but I ran into a small issue when POSTing multipart/form-data. It seems the Bun FormData class has a toJSON method, while Node and Deno do not. It causes the isJSONSerializable() method to return true (exact line below), and therefore sends the serialized payload as application/json instead of multipart/form-data.

Would a value instanceof FormData check make sense here?

typeof value.toJSON === "function"

Additional information

  • Would you be willing to help implement this feature?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions