Fixing a test case.
This commit is contained in:
parent
62c407d846
commit
ae26f66cf9
|
@ -64,13 +64,11 @@ describe("rest", () => {
|
|||
cached = await getCachedVariable(basedOnQuery._id!, "foo")
|
||||
expect(cached).toBeNull()
|
||||
|
||||
nock("http://one.example.com")
|
||||
.get("/")
|
||||
.reply(200, [{ name: "one" }])
|
||||
const body1 = [{ name: "one" }]
|
||||
const body2 = [{ name: "two" }]
|
||||
nock("http://one.example.com").get("/").reply(200, body1)
|
||||
nock("http://two.example.com").get("/?test=one").reply(500)
|
||||
nock("http://two.example.com")
|
||||
.get("/?test=one")
|
||||
.reply(200, [{ name: "two" }])
|
||||
nock("http://two.example.com").get("/?test=one").reply(200, body2)
|
||||
|
||||
const res = await config.api.query.preview({
|
||||
datasourceId: datasource._id!,
|
||||
|
|
|
@ -163,12 +163,14 @@ class RestIntegration implements IntegrationBase {
|
|||
|
||||
let triedParsing: boolean = false,
|
||||
responseTxt: string | undefined
|
||||
const hasContent = contentLength && parseInt(contentLength) > 0
|
||||
try {
|
||||
if (filename) {
|
||||
return handleFileResponse(response, filename, this.startTimeMs)
|
||||
} else {
|
||||
responseTxt = hasContent && response.text ? await response.text() : ""
|
||||
responseTxt = response.text ? await response.text() : ""
|
||||
const hasContent =
|
||||
(contentLength && parseInt(contentLength) > 0) ||
|
||||
responseTxt.length > 0
|
||||
if (response.status === 204) {
|
||||
data = []
|
||||
raw = ""
|
||||
|
|
Loading…
Reference in New Issue