Quality Assurance Projects - Metric-Imperial Converter - express removed second '/' from request.query properties

Hello,

Thank you for taking a look at my query.

Link to the FCC Project Challenge

One of the FCC tests for this project wants ‘invalid number’ returned from a query of input=1//2gal

The problem is that the second ‘/’ is simply removed

  app.route('/api/convert')
    .get(function (req, res){
      let input = req.query.input;

In fact, none of the properties in console.log(req) contain the second ‘/’ …

…, even the originalURL property removed the second ‘/’.

My question is, how can the raw query, as typed in by the user, be obtained?

I’m using Google Chrome as browser.

The boilerplate template was downloaded 20 Jan 2021.

Live link to my glitch project.

Packages are as supplied in the boilerplate.

    "body-parser": "^1.19.0",
    "chai": "^4.2.0",
    "chai-http": "^4.3.0",
    "cors": "^2.8.5",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "mocha": "^8.2.1"

Thanks again.

Kind regards,

Phil :uk:

Hello,
the link does not seem to work, but my req.originalUrl comes back as
'api/convert?input=1%2F%2F2gal'
Kind regards,
Alessia

Hi Alessia,

Thanks for taking a look. I managed to solve it by using replit instead of glitch.

Kind regards,

Phil

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.