• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nodeshift / faas-js-runtime / 16341850588

17 Jul 2025 09:48AM UTC coverage: 55.699% (-31.8%) from 87.527%
16341850588

Pull #421

github

web-flow
Merge c3bb8e82a into eb6047b08
Pull Request #421: [Snyk] Upgrade fastify from 4.21.0 to 5.4.0

64 of 146 branches covered (43.84%)

Branch coverage included in aggregate %.

195 of 319 relevant lines covered (61.13%)

13.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

68.42
/lib/event-handler.js
1
const { HTTP } = require('cloudevents');
6✔
2

3
// Adds a content type parser for cloudevents, decorates
4
// the request object with an isCloudEvent() function, and
5
// parses any CloudEvent that is part of the request,
6
// attaching it to the request's fcontext.
7
module.exports = exports = function use(fastify) {
6✔
8
  fastify.addContentTypeParser('application/cloudevents+json',
36✔
9
    { parseAs: 'string' }, function(req, body, done) {
10
      done(null, body);
×
11
    });
12

13
  fastify.decorateRequest('isCloudEvent', function() {
36✔
14
    return HTTP.isEvent(this);
30✔
15
  });
16

17
  fastify.addHook('preHandler', function(request, reply, done) {
36✔
18
    if (request.isCloudEvent()) {
30✔
19
      try {
18✔
20
        request.fcontext.cloudevent = HTTP.toEvent(request);
18✔
21
        request.fcontext.cloudevent.validate();
18✔
22
      } catch (err) {
23
        if (err.message.startsWith('invalid spec version')) {
×
24
          reply.code(406);
×
25
        }
26
        done(err);
×
27
      }
28
    }
29
    done();
30✔
30
  });
31
};
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc