Closed ambrons closed 7 years ago
So it turns out I wasn't doing anything wrong. My libraries were a bit out of data. I was using Glue v3.3.1
and Hapi v15.x
. After updating both of those to the latest it just started working.
I knew the code looked right on both ends, but for the life of me couldn't figure out why it wasn't working. My guess is there was a bug in onPostHandler
in Hapi or perhaps in glue as it tries to combine event handlers that was fixed since I last installed.
I've created an example project that shows the technology I use working with hapi-pagination
. It's available here:
https://github.com/ambrons/hapi-pagination-example
That's good to know!
Thanks for the repository, I'll take a look.
Thanks, If I get some more time I might track down when and what exactly fixed it.
I've been trying to get the meta data to show up in the result when using the formation:
This yields the results as an array by itself instead of wrapped in an object with
{ meta:..., results:... }
. I've traced through theext.js
file and over theonPostHandler
function. theresponse
just prior toreply.continue(response)
produces the right result, however what the client gets is wrong.Actually I've converted the
reply.continue(response)
to areply(response
, just for testing and it works as expected. I know thatreply.continue
is suppose to be the way to go with pre and post handlers. I've also checked and I don't see to have any otheronPostHandler
that could be causing the issue that I can tell.I'm using multiselection, but that doesn't see to be the issue. Also switching
meta.location = 'header'
produces the correction headers for the next, prev, etc links. However I want them in the body.I'm using glue as an FYi. I've included the snippets that might help:
Glue Yaml - Plugin Configuration
Route Configuration and Handler
The line referenced above in question: https://github.com/fknop/hapi-pagination/blob/master/lib/ext.js#L250
The request seems to be working fine:
I've also tried switch from
request.totalCount
toThis ends up producing an object like so: