1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-04 03:00:05 +00:00

Merge pull request #356 from sasjs/issue657

fix: increasing timeout, closes #657
This commit is contained in:
Muhammad Saad
2021-05-10 16:17:14 +05:00
committed by GitHub
6 changed files with 23 additions and 34 deletions

View File

@@ -314,9 +314,7 @@ export class ContextManager {
contextId: string, contextId: string,
accessToken?: string accessToken?: string
): Promise<ContextAllAttributes> { ): Promise<ContextAllAttributes> {
const { const { result: context } = await this.requestClient
result: context
} = await this.requestClient
.get<ContextAllAttributes>( .get<ContextAllAttributes>(
`${this.serverUrl}/compute/contexts/${contextId}`, `${this.serverUrl}/compute/contexts/${contextId}`,
accessToken accessToken

View File

@@ -594,16 +594,15 @@ export class SASViyaApiClient {
} }
} }
const { const { result: createFolderResponse } =
result: createFolderResponse await this.requestClient.post<Folder>(
} = await this.requestClient.post<Folder>( `/folders/folders?parentFolderUri=${parentFolderUri}`,
`/folders/folders?parentFolderUri=${parentFolderUri}`, {
{ name: folderName,
name: folderName, type: 'folder'
type: 'folder' },
}, accessToken
accessToken )
)
// update folder map with newly created folder. // update folder map with newly created folder.
await this.populateFolderMap( await this.populateFolderMap(
@@ -875,9 +874,7 @@ export class SASViyaApiClient {
throw new Error(`URI of job definition was not found.`) throw new Error(`URI of job definition was not found.`)
} }
const { const { result: jobDefinition } = await this.requestClient
result: jobDefinition
} = await this.requestClient
.get<JobDefinition>( .get<JobDefinition>(
`${this.serverUrl}${jobDefinitionLink.href}`, `${this.serverUrl}${jobDefinitionLink.href}`,
accessToken accessToken
@@ -1103,7 +1100,7 @@ export class SASViyaApiClient {
const { result: state } = await this.requestClient const { result: state } = await this.requestClient
.get<string>( .get<string>(
`${this.serverUrl}${stateLink.href}?_action=wait&wait=30`, `${this.serverUrl}${stateLink.href}?_action=wait&wait=300`,
accessToken, accessToken,
'text/plain', 'text/plain',
{}, {},
@@ -1130,7 +1127,7 @@ export class SASViyaApiClient {
if (stateLink) { if (stateLink) {
const { result: jobState } = await this.requestClient const { result: jobState } = await this.requestClient
.get<string>( .get<string>(
`${this.serverUrl}${stateLink.href}?_action=wait&wait=30`, `${this.serverUrl}${stateLink.href}?_action=wait&wait=300`,
accessToken, accessToken,
'text/plain', 'text/plain',
{}, {},

View File

@@ -91,10 +91,7 @@ export class SessionManager {
} }
private async createAndWaitForSession(accessToken?: string) { private async createAndWaitForSession(accessToken?: string) {
const { const { result: createdSession, etag } = await this.requestClient
result: createdSession,
etag
} = await this.requestClient
.post<Session>( .post<Session>(
`${this.serverUrl}/compute/contexts/${ `${this.serverUrl}/compute/contexts/${
this.currentContext!.id this.currentContext!.id

View File

@@ -71,10 +71,8 @@ export class WebJobExecutor extends BaseJobExecutor {
} else { } else {
// param based approach // param based approach
try { try {
const { const { formData: newFormData, requestParams: params } =
formData: newFormData, generateTableUploadForm(formData, data)
requestParams: params
} = generateTableUploadForm(formData, data)
formData = newFormData formData = newFormData
requestParams = { ...requestParams, ...params } requestParams = { ...requestParams, ...params }
} catch (e) { } catch (e) {

View File

@@ -214,9 +214,8 @@ export class RequestClient implements HttpClient {
const headers = this.getHeaders(accessToken, 'application/json') const headers = this.getHeaders(accessToken, 'application/json')
if (this.fileUploadCsrfToken?.value) { if (this.fileUploadCsrfToken?.value) {
headers[ headers[this.fileUploadCsrfToken.headerName] =
this.fileUploadCsrfToken.headerName this.fileUploadCsrfToken.value
] = this.fileUploadCsrfToken.value
} }
try { try {
@@ -333,9 +332,9 @@ export class RequestClient implements HttpClient {
} }
private parseCsrfToken = (response: AxiosResponse): CsrfToken | undefined => { private parseCsrfToken = (response: AxiosResponse): CsrfToken | undefined => {
const tokenHeader = (response.headers[ const tokenHeader = (
'x-csrf-header' response.headers['x-csrf-header'] as string
] as string)?.toLowerCase() )?.toLowerCase()
if (tokenHeader) { if (tokenHeader) {
const token = response.headers[tokenHeader] const token = response.headers[tokenHeader]

View File

@@ -28,12 +28,12 @@ describe('urlValidator', () => {
it('should return false when the URL is null', () => { it('should return false when the URL is null', () => {
const url = null const url = null
expect(isUrl((url as unknown) as string)).toEqual(false) expect(isUrl(url as unknown as string)).toEqual(false)
}) })
it('should return false when the URL is undefined', () => { it('should return false when the URL is undefined', () => {
const url = undefined const url = undefined
expect(isUrl((url as unknown) as string)).toEqual(false) expect(isUrl(url as unknown as string)).toEqual(false)
}) })
}) })