-
Notifications
You must be signed in to change notification settings - Fork 72
New issue
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
Change the HTTP gateway for ChainAPI test calls #1794
Conversation
Changes: - Return data from successful API calls that fail processing - Make reserved parameters inaccessible in pre/post processing
Related: #1673 |
The conclusion of this discussion is to proceed with merging this and make reserved parameters inaccessible in post processing later when they get passed to post processing as part of #1673 (they are currently not passed to post processing). |
|
||
if (payload.type === 'http-gateway') { | ||
// Add back reserved parameters for the HTTP gateway special case | ||
parameters = Object.entries(aggregatedApiCall.parameters).reduce((params, [key, value]) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same with this. maybe worth adding a general function to remove reserved parameters from an object?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line being commented on is where reserved parameters are added back rather than removed, but I know what you mean so I added two functions: one to remove reserved parameters and one to re-insert them after processing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work 👍🏻
Closes #1738
Changes made for HTTP gateway requests:
For 1, a new type,
HttpGatewayApiCallPartialResponse
, was added for the scenario of a HTTP gateway request that returns data from the API call but fails processing. Within this type there is anerrorMessage
field andsuccess
is set totrue
, which is necessary to bubble thedata
field (API response) back up through the call stack.For 2, only
preProcessApiSpecifications
was modified. No changes were made topostProcessApiSpecifications
because post processing only takes the raw API response data and endpoint array (for extraction ofpostProcessingSpecifications
) as inputs and not reserved parameters:airnode/packages/airnode-node/src/api/index.ts
Line 222 in dbde93c