From 277e4ed49da301a8e4cfd4138e2a6dfbd9c2562a Mon Sep 17 00:00:00 2001 From: Tino Fuhrmann Date: Sun, 24 May 2020 15:05:11 +0200 Subject: [PATCH] Fixed compile issues in ts-refactor jquery http test --- .../typescript/tests/jquery/test/http/jquery.test.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts b/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts index c8715e14a27..007ff42b824 100644 --- a/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts +++ b/samples/openapi3/client/petstore/typescript/tests/jquery/test/http/jquery.test.ts @@ -17,10 +17,12 @@ for (let libName in libs) { return new Promise((resolve, reject) => { lib.send(requestContext).toPromise().then((resp: petstore.ResponseContext) => { assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200"); - let body = JSON.parse(resp.body); + return resp.body.text() + }).then((txtBody: string) => { + let body = JSON.parse(txtBody); assert.ok(body["headers"]); assert.equal(body["headers"]["X-Test-Token"],"Test-Token"); - resolve() + resolve() }, (e: any) => { console.error(e) @@ -44,12 +46,14 @@ for (let libName in libs) { lib.send(requestContext).toPromise().then( (resp: petstore.ResponseContext) => { assert.ok(resp.httpStatusCode, 200, "Expected status code to be 200"); - let body = JSON.parse(resp.body); + return resp.body.text() + }).then((txtBody: any) => { + let body = JSON.parse(txtBody); assert.ok(body["headers"]); assert.equal(body["headers"]["X-Test-Token"], "Test-Token"); assert.equal(body["files"]["testFile"], "abc"); assert.equal(body["form"]["test"], "test2"); - resolve(); + resolve(); }, (e: any) => { console.error(e)