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

supabase / storage / 22734534051

05 Mar 2026 08:06PM UTC coverage: 76.061% (-0.02%) from 76.078%
22734534051

Pull #893

github

web-flow
Merge 64dbec570 into bb602aa99
Pull Request #893: feat: upgrade fastify to v5

3948 of 5651 branches covered (69.86%)

Branch coverage included in aggregate %.

52 of 81 new or added lines in 10 files covered. (64.2%)

21 existing lines in 6 files now uncovered.

26650 of 34577 relevant lines covered (77.07%)

187.97 hits per line

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

93.33
/src/http/plugins/xml.ts
1
import accepts from '@fastify/accepts'
2✔
2
import { FastifyInstance } from 'fastify'
2✔
3
import fastifyPlugin from 'fastify-plugin'
2✔
4
// no types exists for this package
2✔
5
// @ts-ignore
2✔
6
import xmlBodyParser from 'fastify-xml-body-parser'
2✔
7
import xml from 'xml2js'
2✔
8

2✔
9
export const xmlParser = fastifyPlugin(
2✔
10
  async function (
2✔
11
    fastify: FastifyInstance,
2,882✔
12
    opts: { disableContentParser?: boolean; parseAsArray?: string[] }
2,882✔
13
  ) {
2,882✔
14
    fastify.register(accepts)
2,882✔
15

2,882✔
16
    if (!opts.disableContentParser) {
2,882✔
17
      fastify.register(xmlBodyParser, {
2,620✔
18
        contentType: ['text/xml', 'application/xml'],
2,620✔
19
        isArray: (_: string, jpath: string) => {
2,620✔
20
          return opts.parseAsArray?.includes(jpath)
42✔
21
        },
2,620✔
22
      })
2,620✔
23
    }
2,620✔
24

2,882✔
25
    fastify.addHook('preSerialization', async (req, res, payload) => {
2,882✔
26
      const accept = req.accepts()
2✔
27

2✔
28
      const acceptedTypes = ['application/xml', 'text/html']
2✔
29

2✔
30
      if (acceptedTypes.some((allowed) => accept.types(acceptedTypes) === allowed)) {
2✔
31
        res.serializer((payload) => payload)
2✔
32

2✔
33
        const xmlBuilder = new xml.Builder({
2✔
34
          renderOpts: {
2✔
35
            pretty: false,
2✔
36
          },
2✔
37
        })
2✔
38
        const xmlPayload = xmlBuilder.buildObject(payload)
2✔
39
        res.type('application/xml')
2✔
40
        res.header('content-type', 'application/xml; charset=utf-8')
2✔
41
        return xmlPayload
2✔
42
      }
2✔
UNCOV
43

×
UNCOV
44
      return payload
×
45
    })
2,882✔
46
  },
2,882✔
47
  { name: 'xml-parser' }
2✔
48
)
2✔
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