Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Blob to RepositoryFiles.showRaw response type #3418

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

mercutiodesign
Copy link
Contributor

When downloading an image, the response type is actually Blob for this endpoint. The current type hint suggests that it will always return a string.

Example test case:

import { Gitlab } from "@gitbeaker/rest";

describe("GitLab", () => {
  const api = new Gitlab({ token });

  it("loads an image as a Blob", async () => {
    const response = (await api.RepositoryFiles.showRaw(
      "gitlab-org/gitlab-runner",
      "docs/configuration/img/autoscale-example.png",
      "f8917ca0d5be65b2eb8af5522c20e8e1e2f62e45"
    )) as any;
    assert(response instanceof Blob);
  });
});

@jdalrymple
Copy link
Owner

Hmm, may be a typo! Ez fix

@jdalrymple jdalrymple added the type:bug Changes fix a minor bug label Oct 2, 2023
@jdalrymple
Copy link
Owner

Would it be a string ever?

@mercutiodesign
Copy link
Contributor Author

Would it be a string ever?

Yes, it's usually a string for files that are text-like, such as source code / markdown / plain text. So I think it's best to keep both types as potential response types.

@jdalrymple jdalrymple merged commit b2df614 into jdalrymple:main Oct 2, 2023
1 of 2 checks passed
@jdalrymple
Copy link
Owner

🚀 PR was released in 39.17.0 🚀

@jdalrymple jdalrymple added the released This issue/pull request has been released. label Oct 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue/pull request has been released. type:bug Changes fix a minor bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants