Commit Graph

4 Commits

Author SHA1 Message Date
Daniel Lockyer
8574bcd30a Refactored api-framework to use optional chaining
- this makes the code more readable and succinct
2022-08-12 10:16:01 +02:00
Daniel Lockyer
c017174c9a Lazily executed calculating headers in API framework
- if the API controller endpoint is a function, we early return as we
  expect the function to handle the response but we still ended up
  calculating the headers beforehand, only to be thrown away
- this commit moves the header fetching code down in the flow so it's
  only executed when needed
- this doesn't really have a big effect for us because 99% of our
  controllers follow the object pattern
2022-08-12 10:16:01 +02:00
Daniel Lockyer
348924d431 Updated API framework debug and test names
- these tests have moved from `core/` so the names are no longer
  relevant
2022-08-11 17:44:59 +02:00
Daniel Lockyer
687e68d5de Extracted shared API framework to separate package
refs https://github.com/TryGhost/Toolbox/issues/363

- this API framework is standalone and should be pulled out into a
  separate package so we can define its boundaries more clearly, and
  promote better testing of smaller parts
2022-08-11 17:44:59 +02:00