* Remove the check for returning more than one result in JSON. If it's an array of objects, the following lines will just stringify. This allows the response to be parsed by JSONPath
* Update test to permit more than one result
* add edge-case
Co-authored-by: Filipe Freire <livrofubia@gmail.com>
* Fix issue chaining multiple requests
* refactor: use switch to prepare for leveraging exhaustiveness checking
since this will be in TypeScript soon, and this was as topical a time as any to make this change.
* fixes failing test with new behavior (and removes unused `fromResponseTag`)
* fix tests
Co-authored-by: Vincenzo De Petris <vincenzodepetris@gmail.it>
Co-authored-by: Dimitri Mitropoulos <dimitrimitropoulos@gmail.com>
Co-authored-by: Opender Singh <opender.singh@konghq.com>
This adds a new trigger condition for re-sending a request for the
`response` plugin called "When Expired". This condition allows
specifying a maximum age of a response to use. This is very useful when
configuring a hierarchy of environment variables that ultimately depend
on an auth token that needs to be refreshed periodically.
Previous workarounds are:
1. Use "always refresh". This fails in cases where you must use the same
auth token since it is refreshed for every request.
2. Use "no history" or "never" and manually refresh the token. This is
inconvenient and requires pinning the token.
Alternative solutions are:
1. Add more sophisticated logic to determine when the token needs to be
refreshed (e.g. refresh if the current request returns a `401` status
code)
2. Write a custom response plugin to time out the token. I believe this
functionality is small enough and general enough to be contributed
back generally.
Fixes#1972