R
R
Robot Chappie2018-05-04 09:53:30
JavaScript
Robot Chappie, 2018-05-04 09:53:30

+ sign in url.parse?

for example, there is a line
/?test=1&test1=+
execute in node.js

> url.parse('/?test=1&test1=+', true).query
{ test: '1', test1: ' ' }

the plus sign was replaced by a space, if you specify another sign, for example, minus or equal, then everything is ok. what could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
J
JaxxDexx, 2018-05-04
@BenderLib

We read RFC-1866, namely 8.2.1

J
Jumandjilos, 2018-05-04
@Jumandjilos

So in JS, the plus sign seems to be a sign for gluing strings, so for example, when adding two strings, they have to be cast to the Number type, but for example, when subtracting, everything is fine. Just don't use plus in such queries

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question