Skip to content

Instantly share code, notes, and snippets.

@ShvedAction
Last active August 10, 2021 11:53
Show Gist options
  • Save ShvedAction/cd26c54a1b9e74e52fb8c8a1d11d326d to your computer and use it in GitHub Desktop.
Save ShvedAction/cd26c54a1b9e74e52fb8c8a1d11d326d to your computer and use it in GitHub Desktop.
Single quote escape problem
const express = require('express');
const app = express();
const port = 3000;
app.get("/*", (req, res)=>{
console.log(req.originalUrl, req._parsedUrl);
res.send(req.originalUrl);
});
app.listen(port, console.log.bind(console, "server started"));
setTimeout(()=>{
const request = require('request');
request({url: "http://127.0.0.1:3000/asdf's"})
}, 1500);
// setTimeout(()=>{
// const http = require('http');
// const options = {
// hostname: 'localhost',
// port,
// path: '/single\'quote',
// method: 'GET'
// };
// const req = http.request(options, res => {
// console.log(`statusCode: ${res.statusCode}`)
// res.on('data', d => {
// process.stdout.write(d)
// })
// });
// req.on('error', error => {
// console.error(error)
// });
// req.end();
// }, 1500);
// curl "http://localhost:3000/curl'single_quote"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment