-
Notifications
You must be signed in to change notification settings - Fork 1.2k
refactor: migrate http api to use hapi 18 #1844
Conversation
This PR refactors the HTTP API for use with Hapi 18 in preparation for ipfs/js-ipfs#1844. License: MIT Signed-off-by: Alan Shaw <[email protected]>
// Replaces this: // ...with this: i think the reply was like that for Go interop, am i wrong ? |
The error handler catches the error and transforms it into a |
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
Infer error code from status code if not set. License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
a897118
to
f7515d1
Compare
Slightly more urgent now - Hapi 16 depends on |
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.
Didn't review in depth, but I applause upgrading to hapi 18 👏🏽👏🏽👏🏽👏🏽
Okay, I'm going to merge this. It makes me nervous having a PR with so much change hanging around! It LGTM 🤣 and all the tests are passing. Lets PR for any breaks / changes after merge. |
DEAR REVIEWERS, SORRY THAT THIS PR IS HUGE 😞
This PR refactors the HTTP API for use with Hapi 18.
The current code works with Hapi 16. This is now two major versions behind the current version and we need to update our code to keep up to date with the latest bug/security fixes and performance improvements.
Hapi 17 introduced significant breaking changes, along with a switch from a callback API to a promises API hence the code changes to support this are also significant.
This PR includes:
async
/await
withtry
/catch
over.then
/.catch
for easier to understand and more succinct code - Hapi 17+ uses this syntax and it's supported in Node.js since version 8boom
to throw errors with specific HTTP status codes e.g./api/v0/add
- response is no longer buffered in memory, instead it is streamed to the clientrefs #1670