mirror of
https://github.com/sasjs/adapter.git
synced 2026-01-20 02:20:05 +00:00
fix: retrieve content from the iframe in first response when viya Web approach used with debug enabled
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
import { isUrl } from './utils'
|
import { isUrl, isValidJson, parseSasViyaDebugResponse } from './utils'
|
||||||
import { UploadFile } from './types/UploadFile'
|
import { UploadFile } from './types/UploadFile'
|
||||||
import { ErrorResponse, LoginRequiredError } from './types/errors'
|
import { ErrorResponse, LoginRequiredError } from './types/errors'
|
||||||
import { RequestClient } from './request/RequestClient'
|
import { RequestClient } from './request/RequestClient'
|
||||||
@@ -63,13 +63,28 @@ export class FileUploader {
|
|||||||
|
|
||||||
return this.requestClient
|
return this.requestClient
|
||||||
.post(uploadUrl, formData, undefined, 'application/json', headers)
|
.post(uploadUrl, formData, undefined, 'application/json', headers)
|
||||||
.then((res) => {
|
.then(async (res) => {
|
||||||
let result
|
// for web approach on Viya
|
||||||
|
if (
|
||||||
|
this.sasjsConfig.debug &&
|
||||||
|
(this.sasjsConfig.useComputeApi === null ||
|
||||||
|
this.sasjsConfig.useComputeApi === undefined) &&
|
||||||
|
this.sasjsConfig.serverType === ServerType.SasViya
|
||||||
|
) {
|
||||||
|
const jsonResponse = await parseSasViyaDebugResponse(
|
||||||
|
res.result as string,
|
||||||
|
this.requestClient,
|
||||||
|
this.sasjsConfig.serverUrl
|
||||||
|
)
|
||||||
|
return typeof jsonResponse === 'string'
|
||||||
|
? isValidJson(jsonResponse)
|
||||||
|
: jsonResponse
|
||||||
|
}
|
||||||
|
|
||||||
result =
|
return typeof res.result === 'string'
|
||||||
typeof res.result === 'string' ? JSON.parse(res.result) : res.result
|
? isValidJson(res.result)
|
||||||
|
: res.result
|
||||||
|
|
||||||
return result
|
|
||||||
//TODO: append to SASjs requests
|
//TODO: append to SASjs requests
|
||||||
})
|
})
|
||||||
.catch((err: Error) => {
|
.catch((err: Error) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user