Does http module has a bug?


After some while i’ve noticed that {N} 4.0 has probably a bug in HTTP: (problems with + Sign)?

This will not work, beacuse POSTed data will have empty space instead of +

        //url: '',
        method: 'POST',
        headers: {
            "Content-Type": "application/x-www-form-urlencoded"
// Commented as result of this will be #1
        /*content: JSON.stringify({
                'email': "",
                'password': "password"
// Content set as strong, beacuse this results in well formatted string #2
        content: ''

    }).then(function(response) {
        result = response.content.toJSON();
        console.log('Https.request response', result)
    }).catch(function(error) {
        console.error('Https.request error', error)

#1 is commented for now, as i have some question, but later.

  • For now most important is that email is invalid (+ will be generated as empty space)

  • Second question: JSON.stringify will produce bad result for me:

CONSOLE LOG file:///app/login/login.js:51:20: Https.request response {
"{\"email\":\"\",\"password\":\"password\"}": "",

But content as string produces: (expected result):

CONSOLE LOG file:///app/login/login.js:51:20: Https.request response {
"email": "",
"password": "password",

Possible to have this string without doing ugly:
content: ''

Thank you.


Would be interesting to see the result if you replace “+” with “%2B”.


Yes @vamsi, this will work. But as you know it’s confusing, as i would have to do lots of checks on what user typed in case of replace + with &2B. Cheers.


Agree, http module should take care of the conversion.