1 year ago
#387597
Thytu
OpenAPI Warning: .end() was called twice. This is not supported in superagent
I generate my sdk with openapi-generator with the following command :
docker run --network=host --rm \
-v $(pwd)/clients:/tmp \
openapitools/openapi-generator-cli:v{open_api_generator_version} generate \
-i {url}/openapi.json \
-o /tmp/{language} \
-D modelDocs=false \
-D apiDocs=false \
-D apiTests=false \
-D modelTests=false \
-D npmVersion=3.5.2 \
-D supportsES6=true \
-g javascript
But when I call my api with the SDK it result with the following error:
Warning: .end() was called twice. This is not supported in superagent
Executed code:
useEffect(() => {
const api = new MyApi()
api.apiClient.basePath = 'http://localhost:8080'
api.getMyRouteGet().then(res => {
console.log(res)
})
}, [])
PS: I see that when I remove the following code from ApiClient.js
it works:
request.end((error, response) => {
if (callback) {
var data = null;
if (!error) {
try {
data = this.deserialize(response, returnType);
if (this.enableCookies && typeof window === 'undefined'){
this.agent._saveCookies(response);
}
} catch (err) {
error = err;
}
}
callback(error, data, response);
}
});
Do you have any idea what do I do wrong?
javascript
reactjs
openapi
superagent
0 Answers
Your Answer