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)