mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-11 06:10:05 +00:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b4c0946883 | ||
|
|
efcf3b273c | ||
|
|
761bf8de38 | ||
|
|
5ccfc18a35 | ||
|
|
92434e48ad | ||
|
|
d3c91e143a | ||
|
|
872e73b5f0 | ||
|
|
af4ad3a7af | ||
|
|
1ff67ed93c |
@@ -37,7 +37,10 @@ export class SASjsApiClient {
|
|||||||
}>(
|
}>(
|
||||||
'SASjsApi/drive/deploy',
|
'SASjsApi/drive/deploy',
|
||||||
{ fileTree: members, appLoc: appLoc },
|
{ fileTree: members, appLoc: appLoc },
|
||||||
access_token
|
access_token,
|
||||||
|
undefined,
|
||||||
|
{},
|
||||||
|
{ maxContentLength: Infinity, maxBodyLength: Infinity }
|
||||||
)
|
)
|
||||||
|
|
||||||
return Promise.resolve(result)
|
return Promise.resolve(result)
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
|
|
||||||
/* The NodeFormData object does not set the request header - so, set it */
|
/* The NodeFormData object does not set the request header - so, set it */
|
||||||
const contentType =
|
const contentType =
|
||||||
formData instanceof NodeFormData
|
formData instanceof NodeFormData && typeof FormData === 'undefined'
|
||||||
? `multipart/form-data; boundary=${formData.getBoundary()}`
|
? `multipart/form-data; boundary=${formData.getBoundary()}`
|
||||||
: undefined
|
: undefined
|
||||||
|
|
||||||
@@ -208,7 +208,7 @@ export class WebJobExecutor extends BaseJobExecutor {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const responseObject = appendExtraResponseAttributes(
|
const responseObject = appendExtraResponseAttributes(
|
||||||
{ result: jsonResponse },
|
{ result: jsonResponse, log: parsedSasjsServerLog },
|
||||||
extraResponseAttributes
|
extraResponseAttributes
|
||||||
)
|
)
|
||||||
resolve(responseObject)
|
resolve(responseObject)
|
||||||
|
|||||||
@@ -207,7 +207,8 @@ export class RequestClient implements HttpClient {
|
|||||||
data: any,
|
data: any,
|
||||||
accessToken: string | undefined,
|
accessToken: string | undefined,
|
||||||
contentType = 'application/json',
|
contentType = 'application/json',
|
||||||
overrideHeaders: { [key: string]: string | number } = {}
|
overrideHeaders: { [key: string]: string | number } = {},
|
||||||
|
additionalSettings: { [key: string]: string | number } = {}
|
||||||
): Promise<{ result: T; etag: string }> {
|
): Promise<{ result: T; etag: string }> {
|
||||||
const headers = {
|
const headers = {
|
||||||
...this.getHeaders(accessToken, contentType),
|
...this.getHeaders(accessToken, contentType),
|
||||||
@@ -215,7 +216,11 @@ export class RequestClient implements HttpClient {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return this.httpClient
|
return this.httpClient
|
||||||
.post<T>(url, data, { headers, withCredentials: true })
|
.post<T>(url, data, {
|
||||||
|
headers,
|
||||||
|
withCredentials: true,
|
||||||
|
...additionalSettings
|
||||||
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
throwIfError(response)
|
throwIfError(response)
|
||||||
|
|
||||||
@@ -630,7 +635,7 @@ const parseError = (data: string) => {
|
|||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
const storedProcessPath = parts[1].split('<i>')[1].split('</i>')[0]
|
const storedProcessPath = parts[1].split('<i>')[1].split('</i>')[0]
|
||||||
const message = `Stored process not found: ${storedProcessPath}`
|
const message = `Stored process not found: ${storedProcessPath}`
|
||||||
return new JobExecutionError(404, message, '')
|
return new JobExecutionError(500, message, '')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
@@ -644,7 +649,7 @@ const parseError = (data: string) => {
|
|||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
const log = parts[1].split('<pre>')[1].split('</pre>')[0]
|
const log = parts[1].split('<pre>')[1].split('</pre>')[0]
|
||||||
const message = `This request completed with errors.`
|
const message = `This request completed with errors.`
|
||||||
return new JobExecutionError(404, message, log)
|
return new JobExecutionError(500, message, log)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (_) {}
|
} catch (_) {}
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ export const getValidJson = (str: string | object): object => {
|
|||||||
|
|
||||||
if (typeof str === 'object') return str
|
if (typeof str === 'object') return str
|
||||||
|
|
||||||
|
if (str === '') return {}
|
||||||
|
|
||||||
return JSON.parse(str)
|
return JSON.parse(str)
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (e instanceof JsonParseArrayError) throw e
|
if (e instanceof JsonParseArrayError) throw e
|
||||||
|
|||||||
Reference in New Issue
Block a user