Skip to content

Plus sign is stripped from a variable value (both from a variables file and cmd arguments)  #1852

Open
@OpossumPetya

Description

@OpossumPetya

What is the current bug behavior?

When I try to supply a variable with a value that contains one leading plus sign (+), the plus char is being stripped from the value.

  • Options section -- NOT STRIPPED
  • Env variable "quoted" -- NOT STRIPPED
  • Env variable not quoted -- stripped
  • --variable cmd line options (quoted or not, cmd, powershell, wsl2/ubuntu)-- stripped
  • --variables-file -- stripped

Steps to reproduce

Hurl file:

POST https://domain.com/service
Content-Type: application/soap+xml; charset=utf-8
SOAPAction: ""
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        ...
            <data>
                <phonenum>{{phonenum}}</phonenum>
                <var1>{{var1}}</var1>
                ...
            </data>
        ...
    </soap:Body>
</soap:Envelope>

HTTP 200

Try 1

hurl api-call.hurl --variable phonenum="+491702001122" --variable var2="FOO" --variable var3="BAR" --very-verbose
* Options:
*     fail fast: true
*     follow redirect: false
*     insecure: false
*     max redirect: 50
*     retry: 0
* Variables:
*     var2: FOO
*     phonenum: 491702001122
*     var3: BAR
* ------------------------------------------------------------------------------
* Executing entry 1
*

I tried with and without quotes.

Try 2:

Variables file:

phonenum: +491702001122
var2: FOO
var3: BAR

Output:

hurl api-call.hurl --variables-file=api-call.vars --verbose
* Options:
*     fail fast: true
*     follow redirect: false
*     insecure: false
*     max redirect: 50
*     retry: 0
* Variables:
*     var3: BAR
*     phonenum: 491702001122
*     var2: FOO
* ------------------------------------------------------------------------------
* Executing entry 1
*

In both tries API call wasn't successful. But if I hardcode phonenum value -- it succeeds every time.

What is the expected correct behavior?

Expected plus sign not to be striped, and show in Variables: debug output exactly as I pass it in (and also interpolate in the XML body).

Execution context

  • Hurl Version: 4.0.0
  • Operating system and version: Win11
  • Tried in windows' Command Prompt and Windows PowerShell and from WSL2/Ubuntu

Notes

  • I couldn't get [Options] section to work: Options section doesn't work with XML body #1851
    NOT A PROBLEM when using the [Options] section!

  • I tried with environment variable: when I did not use quote, plus was stripped in the Variables verbose output; and plus wasn't stripped if I used quotes! but the call still didn't work :( and I wonder if it's another bug. Looking for a way to see the complete raw body that Hurl sends :-/

> set HURL_phonenum="+491702001122"

> set | find /i "HURL"
HURL_phonenum="+491702001122"

> hurl api-call.hurl --variable var2="FOO" --variable var3="BAR" --very-verbose
* Options:
*     fail fast: true
*     follow redirect: false
*     insecure: false
*     max redirect: 50
*     retry: 0
* Variables:
*     var3: BAR
*     phonenum: +491702001122
*     var2: FOO
* ------------------------------------------------------------------------------
* Executing entry 1
*

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions