oha icon indicating copy to clipboard operation
oha copied to clipboard

Not able to run -H with content body

Open kenessajr opened this issue 4 years ago • 1 comments

oha -z 20s -H "Authorization: Bearer $TOKEN" -T application/json -d to=+25078xxxxxx text="Hello" sender="Hello" 'https://api.pindo.io/v1/sms/' 
error: Found argument 'sender=Hello' which wasn't expected, or isn't valid in this context

USAGE:
    oha [FLAGS] [OPTIONS] <url>

For more information try --help

kenessajr avatar Jul 06 '21 21:07 kenessajr

Currently, -d option takes one argument and just set HTTP body. The command failed because it parsed to=+25078xxxxxx as body, text="Hello" as URL, and the rest as invalid arguments.

oha -z 20s -H "Authorization: Bearer $TOKEN" -T application/json -d 'to=+25078xxxxxx&text=Hello&sender=Hello' 'https://api.pindo.io/v1/sms/'

would works.

hatoo avatar Jul 07 '21 03:07 hatoo