gitbeaker
gitbeaker copied to clipboard
RepositoryFiles.showRaw defines return type as Blob but returns string
showRaw
method is defined as follows:
export declare class RepositoryFiles<C extends boolean = false> extends BaseResource<C> {
...
showRaw(projectId: string | number, filePath: string, options?: BaseRequestOptions): Promise<Blob>;
}
But as far as I can see in reality it returns string
instead of Blob
:
Is it a wrong typing or I miss something?
Sounds like i messed up the return type haha The processor in the backend encodes the response based on the content type. So even though its 'raw' (which is why its typed as a Blob), it could return a string, json or a blob. This is definitely a bug. Ill have to think of a way to enforce the return format.
Normally this isnt an issue because the return types are constant and consistent for each endpoint. This would be an exception.
Update: it will return blob, the user will need to determine how they want to handle the blobbed response, either converting to string via .toString(), or writing to a file, in the case its an array buffer for example
:rocket: Issue was released in 37.0.0
:rocket: