-
Notifications
You must be signed in to change notification settings - Fork 8
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
Prepare fastify-accepts-serializer master for v2 #4
Conversation
Not sure why coveralls decreases 50% 😄 |
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.
LGTM
There might be a problem with tests here. I think they are not running properly. |
cc @allevo? |
I think I found it, trying to fix. In plugin definition it begins with
Looks like register doesnt have a callback any more?
|
+1 |
What is the current equivalent this? const config = {
serializer: {
serializers: [
{
regex: /^application\/yaml$/,
serializer: body => 'my-custom-string'
},
{
regex: /^application\/x-msgpack$/,
serializer: body => 'my-custom-string-msgpack'
}
]
}
}
fastify.get('/request', { config }, function (req, reply) {
reply.send({pippo: 'pluto'})
}) Currently only at the route level I guess like: fastify.get('/request2', function (req, reply) {
reply
.header('Content-Type', 'application/x-msgpack')
.serializer(_ => 'my-custom-string-msgpack')
.send({ pippo: 'pluto' })
}) |
I seem to have fixed tests but they fail. There are 3 groups of tests and each pass on their own but not together. Couldn't figure out why they are interfering with each other 🤔 |
index.js
Outdated
}) | ||
if (serializer) { | ||
reply.type(type) | ||
reply._serializer = serializer.serializeFunction |
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 work correctly?
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.
Strangely yes. You can take this one over if you want.
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.
Ok not strangely actually since this is still against fastify 1.x. This work is just for getting everything up to date and marking the transition.
nevermind this 😄
"unit": "mocha --check-leaks --full-trace --throw-deprecation --allow-uncaught test/*.js", | ||
"test": "npm run lint && npm run unit", | ||
"coverage": "nyc --reporter=lcov --reporter=html --check-coverage --lines 100 npm run unit", | ||
"coveralls": "nyc report --reporter=text-lcov | coveralls" |
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 is needed by CI
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.
It can work without that actually. tap can automatically forward to coveralls.
https://github.com/cemremengu/fastify-oracle/blob/master/package.json#L6
Let me see if that works
I 've added "COVERALLS_REPO_TOKEN" env var during the build. So the coverage will be sent automatically to coveralls (I hope) |
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.
LGTM
Thanks a lot!!
@allevo no problem it was a good challenge and practice, thanks for bearing with me! 😄 |
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.
LGTM
This is for preparing master branch for v2.
I think there is still work to be done such as:
boom
tap
for testingbut I it's better to include those in the real next branch I think once we merge this 😄