mirror of
https://github.com/jdalrymple/gitbeaker.git
synced 2026-01-25 16:04:01 +00:00
- Set the default for the stream request option
- throw an error if the user tries to stream with xml
This commit is contained in:
parent
adc1985457
commit
a42d9a74dc
@ -30,8 +30,12 @@ function defaultRequest(
|
||||
}
|
||||
|
||||
class RequestHelper {
|
||||
static async get(service, endpoint, options = {}, requestOptions = {}) {
|
||||
if (requestOptions && requestOptions.stream === true) {
|
||||
static async get(service, endpoint, options = {}, { stream = false } = {}) {
|
||||
if (stream) {
|
||||
if(service.useXMLHttpRequest){
|
||||
throw new Error('Cannot use streaming functionality with XMLHttpRequest. Please instantiate without this option to use streaming');
|
||||
}
|
||||
|
||||
return StreamableRequest.get(defaultRequest(service, endpoint, {
|
||||
headers: service.headers,
|
||||
qs: options,
|
||||
|
||||
@ -13,7 +13,7 @@ class Jobs extends BaseService {
|
||||
return RequestHelper.post(this, `projects/${pId}/jobs/${jobId}/play`);
|
||||
}
|
||||
|
||||
downloadSingleArtifactFile(projectId, jobId, artifactPath, { stream = false }) {
|
||||
downloadSingleArtifactFile(projectId, jobId, artifactPath, { stream }) {
|
||||
const pId = encodeURIComponent(projectId);
|
||||
|
||||
return RequestHelper.get(this, `projects/${pId}/jobs/${jobId}/artifacts/${artifactPath}`, {}, { stream });
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user