Skip to content

Commit

Permalink
Removed double await in async and fixed response (#1185)
Browse files Browse the repository at this point in the history
* Removed double await in async 

There's no need to call await again on the result object since result is already resolved.

* Returning just the JSON response in await example 

In the example for async, logging result returns an array containing not just the JSON response but also the rawResponse, rawRequest e.t.c. 
This can be confusing for users who try the async example after trying the non-async examples which only return the JSON response. 

I added a subscript to the 0th index so that that's what's logged.
  • Loading branch information
anasik authored May 18, 2022
1 parent 99832a1 commit 56c7942
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ Construct a `Promise<Client>` with the given WSDL file.
// async/await
var client = await soap.createClientAsync(url);
var result = await client.MyFunctionAsync(args);
console.log(await result);
console.log(result[0]);
```

Note: for versions of node >0.10.X, you may need to specify `{connection: 'keep-alive'}` in SOAP headers to avoid truncation of longer chunked responses.
Expand Down

0 comments on commit 56c7942

Please sign in to comment.