openapi-typescript icon indicating copy to clipboard operation
openapi-typescript copied to clipboard

Headers lost in fetch request when using BUN

Open ryou90 opened this issue 1 year ago • 2 comments

Description

To make Openapi-Fetch more compatible with Bun, the fetch call should be modified. The problem is that Bun removes all header information within the request object. To avoid this problem, the headers should be passed as extra parameters and not within the request object.

See also here: https://github.com/oven-sh/bun/issues/9846

Current behavior :

let response = await fetch(request);

Suggestion:

let response = await fetch(request, {headers : headers});

Reproduction Create simple Get request with header informations.

Expected result

Headers send with request

ryou90 avatar Jun 28 '24 15:06 ryou90

Sounds like a bug in bun not openapi-fetch? I would expect the runtime to conform to the spec instead of having libraries patch all sort of runtime bugs. Especially now since there seems to be a new js runtime every week.

marcomuser avatar Jul 03 '24 17:07 marcomuser

The Bun bug/issue is now closed, so perhaps this is now no longer a problem (when using a sufficiently recent version of Bun)

stevegoossens avatar Aug 08 '24 02:08 stevegoossens