ci: fix errors in ci github action for node 8 and 9 (#523) · expressjs/body-parser@83db46a

@@ -73,13 +73,25 @@ describe('bodyParser()', function () {

7373

})

7474

})

757576+

function getMajorVersion (versionString) {

77+

return versionString.split('.')[0]

78+

}

79+80+

function shouldSkipQuery (versionString) {

81+

// Skipping HTTP QUERY tests on Node 21, it is reported in http.METHODS on 21.7.2 but not supported

82+

// update this implementation to run on supported versions of 21 once they exist

83+

// upstream tracking https://github.com/nodejs/node/issues/51562

84+

// express tracking issue: https://github.com/expressjs/express/issues/5615

85+

return getMajorVersion(versionString) === '21'

86+

}

87+7688

methods.slice().sort().forEach(function (method) {

77-

if (method === 'connect') {

78-

// except CONNECT

79-

return

80-

}

89+

if (method === 'connect') return

81908291

it('should support ' + method.toUpperCase() + ' requests', function (done) {

92+

if (method === 'query' && shouldSkipQuery(process.versions.node)) {

93+

this.skip()

94+

}

8395

request(this.server)[method]('/')

8496

.set('Content-Type', 'application/json')

8597

.set('Content-Length', '15')