!C99Shell v. 2.5 [PHP 8 Update] [24.05.2025]!

Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 

uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 

uid=33(www-data) gid=33(www-data) groups=33(www-data) 

Safe-mode: OFF (not secure)

/usr/local/lib/node_modules/homebridge-config-ui-x/node_modules/fastify/test/   drwxr-xr-x
Free 13.21 GB of 57.97 GB (22.8%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Self remove    Logout    


Viewing file:     emit-warning.test.js (4.52 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
'use strict'

const sget = require('simple-get').concat
const { test } = require('tap')
const Fastify = require('..')
const semver = require('semver')

process.removeAllListeners('warning')

test('Should emit a warning when accessing request.req instead of request.raw', t => {
  t.plan(4)

  process.on('warning', onWarning)
  function onWarning (warning) {
    t.equal(warning.name, 'FastifyDeprecation')
    t.equal(warning.code, 'FSTDEP001')
    t.equal(warning.message, 'You are accessing the Node.js core request object via "request.req", Use "request.raw" instead.')
  }

  const fastify = Fastify()

  fastify.get('/', (request, reply) => {
    reply.send(request.req.method + request.req.method)
  })

  fastify.inject({
    method: 'GET',
    path: '/'
  }, (err, res) => {
    t.error(err)
    process.removeListener('warning', onWarning)
  })
})

test('Should emit a warning when accessing reply.res instead of reply.raw', t => {
  t.plan(4)

  process.on('warning', onWarning)
  function onWarning (warning) {
    t.equal(warning.name, 'FastifyDeprecation')
    t.equal(warning.code, 'FSTDEP002')
    t.equal(warning.message, 'You are accessing the Node.js core response object via "reply.res", Use "reply.raw" instead.')
  }

  const fastify = Fastify()

  fastify.get('/', (request, reply) => {
    reply.send(reply.res.statusCode + reply.res.statusCode)
  })

  fastify.inject({
    method: 'GET',
    path: '/'
  }, (err, res) => {
    t.error(err)
    process.removeListener('warning', onWarning)
  })
})

test('Should emit a warning when using two arguments Content Type Parser instead of three arguments', t => {
  t.plan(7)

  process.on('warning', onWarning)
  function onWarning (warning) {
    t.equal(warning.name, 'FastifyDeprecation')
    t.equal(warning.code, 'FSTDEP003')
    t.equal(warning.message, 'You are using the legacy Content Type Parser function signature. Use the one suggested in the documentation instead.')
  }

  const fastify = Fastify()

  fastify.addContentTypeParser('x/foo', function (req, done) {
    done(null, 'OK')
  })

  fastify.post('/', (request, reply) => {
    reply.send(request.body)
  })

  fastify.listen(0, err => {
    t.error(err)

    sget({
      method: 'POST',
      url: 'http://localhost:' + fastify.server.address().port,
      headers: { 'Content-Type': 'x/foo' },
      body: '{"hello":"world"}'
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(body.toString(), 'OK')
      process.removeListener('warning', onWarning)
      fastify.close()
    })
  })
})

test('Should emit a warning when using payload less preParsing hook', t => {
  t.plan(7)

  process.on('warning', onWarning)
  function onWarning (warning) {
    t.equal(warning.name, 'FastifyDeprecation')
    t.equal(warning.code, 'FSTDEP004')
    t.equal(warning.message, 'You are using the legacy preParsing hook signature. Use the one suggested in the documentation instead.')
  }

  const fastify = Fastify()

  fastify.addHook('preParsing', function (request, reply, done) {
    done()
  })

  fastify.get('/', (request, reply) => {
    reply.send('OK')
  })

  fastify.listen(0, err => {
    t.error(err)

    sget({
      method: 'GET',
      url: 'http://localhost:' + fastify.server.address().port
    }, (err, response, body) => {
      t.error(err)
      t.equal(response.statusCode, 200)
      t.equal(body.toString(), 'OK')
      process.removeListener('warning', onWarning)
      fastify.close()
    })
  })
})

test('Should emit a warning when accessing request.connection instead of request.socket on Node process greater than 13.0.0', t => {
  t.plan(4)

  process.on('warning', onWarning)
  function onWarning (warning) {
    if (semver.gte(process.versions.node, '13.0.0')) {
      t.equal(warning.name, 'FastifyDeprecation')
      t.equal(warning.code, 'FSTDEP005')
      t.equal(warning.message, 'You are accessing the deprecated "request.connection" property. Use "request.socket" instead.')
    } else {
      t.equal(warning.name, 'FastifyDeprecationLightMyRequest')
      t.equal(warning.code, 'FST_LIGHTMYREQUEST_DEP01')
      t.equal(warning.message, 'You are accessing "request.connection", use "request.socket" instead.')
    }

    // removed listener before light-my-request emit second warning
    process.removeListener('warning', onWarning)
  }

  const fastify = Fastify()

  fastify.get('/', (request, reply) => {
    reply.send(request.connection)
  })

  fastify.inject({
    method: 'GET',
    path: '/'
  }, (err, res) => {
    t.error(err)
    process.removeListener('warning', onWarning)
  })
})

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ Read-Only ]

:: Make Dir ::
 
[ Read-Only ]
:: Make File ::
 
[ Read-Only ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0094 ]--