Skip to content

[BUG]: With parseSuccessResponseBody set to false, the return type is improperly set #665

@danielhjacobs

Description

@danielhjacobs

What happened?

With this code:

  const asset = await octokit.rest.repos.getReleaseAsset({
    owner: repository.owner,
    repo: repository.repo,
    asset_id: asset_id,
    headers: {
      accept: "application/octet-stream",
    },
    request: {
      parseSuccessResponseBody: false, // required to access response as stream
    },
  });
  return await new Response(asset.data).json();

I got the error Argument of type '{ url: string; browser_download_url: string; id: number; node_id: string; name: string; label: string | null; state: "uploaded" | "open"; content_type: string; size: number; download_count: number; created_at: string; updated_at: string; uploader: { ...; } | null; }' is not assignable to parameter of type 'BodyInit | null | undefined'

Versions

Octokit 3.1.2, Node 20.

Relevant log output

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: TriageThis is being looked at and prioritizedType: BugSomething isn't working as documented

    Type

    No type

    Projects

    Status

    ✅ Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions