httpie/cli

How to post an empty string as a data field?

maxclac opened this issue · 2 comments

Hi!

How is it possible to post an empty string as a data field like:

http PUT pie.dev/put  name= 

Do I need to escape the empty string somehow?

You don’t need to escape it.


JSON:

$ http -v pie.dev/post name=
POST /post HTTP/1.1
Accept: application/json, */*;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 12
Content-Type: application/json
Host: pie.dev
User-Agent: HTTPie/3.2.2

{
    "name": ""
}

Form:

$ http -v --form  pie.dev/post name=
POST /post HTTP/1.1
Accept: */*
Accept-Encoding: gzip, deflate
Connection: keep-alive
Content-Length: 5
Content-Type: application/x-www-form-urlencoded; charset=utf-8
Host: pie.dev
User-Agent: HTTPie/3.2.2

name=

OK, that's strange. It must be the application that does not understand somehow this empty field and probably not an Httpie problem.