We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hi @robtweed
Just a note for you. I believe you may know about this problem and know what to do (if it's needed ofc)
We just have found a "problem" with processing array responses with microservices logic that related with
Related snippets of code (1): https://github.com/robtweed/qewd/blob/master/lib/appHandler.js#L464-L478 (2): https://github.com/robtweed/qewd-router/blob/master/lib/router.js#L223-L226
When object response returned it goes to (2) and path is set correctly Example:
{ foo: 'bar' path: '/api/test' }
When array response returned it goes to (2) and path is set the following way Example:
[ { foo: 'bar1' }, { foo: 'bar2' }, path: '/api/test' ]
Only after that, the logic goes to (1) to line 469 if (messageObj.ms_requestId && Array.isArray(results)) results = {results: results};
This problem appears with worker response logic because there is no path in messageObj:
qewd/up/ms_handlers.js
Line 248 in 7f92c0a
The quick solution is to use your pattern when you return array response the following way:
{ api: 'getRespectFormVersions', use: 'results', results: [ { foo: 'bar1' }, { foo: 'bar2' }, ] }
However, I believe that it's better to patch qewd-router (2) to process array responses correctly there
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Hi @robtweed
Just a note for you. I believe you may know about this problem and know what to do (if it's needed ofc)
We just have found a "problem" with processing array responses with microservices logic that related with
Related snippets of code
(1): https://github.com/robtweed/qewd/blob/master/lib/appHandler.js#L464-L478
(2): https://github.com/robtweed/qewd-router/blob/master/lib/router.js#L223-L226
Scenario 1 - object response: (problem is not reproduced)
When object response returned it goes to (2) and path is set correctly
Example:
Scenario 2 - array response:
When array response returned it goes to (2) and path is set the following way
Example:
Only after that, the logic goes to (1) to line 469
if (messageObj.ms_requestId && Array.isArray(results)) results = {results: results};
This problem appears with worker response logic because there is no path in messageObj:
qewd/up/ms_handlers.js
Line 248 in 7f92c0a
HOW TO FIX IT
The quick solution is to use your pattern when you return array response the following way:
{
api: 'getRespectFormVersions',
use: 'results',
results: [
{
foo: 'bar1'
},
{
foo: 'bar2'
},
]
}
However, I believe that it's better to patch qewd-router (2) to process array responses correctly there
The text was updated successfully, but these errors were encountered: