talis-fb / TReq

A CLI tool for effortless HTTP requests
GNU General Public License v3.0
50 stars 3 forks source link

BUG: Invalid non-string value like `key:={"name":]` are parsed #34

Closed talis-fb closed 6 months ago

talis-fb commented 6 months ago

Invalid non-string values like key:={"name":] are parsed for normal string values, because they match in regex of body-value

^(?<key>[ -~]+)=(?<value>[ -~]+)$

The problem is here.... As the parsers_request_items::non_string_body_value return a None (as it not parse it), the next function accept. image

SummerGram commented 6 months ago

This one is interesting.

We need to further define the body_value.

key:={"name":] can be viewed as { "key:" : "{\"name\":]" }.

A simpler case is key:=name. Is it counted as invalid? Or is it viewed as { "key:" : "name"}?

How do we deal with key which has : at the end?

I think we should not allow there is a key with : at the end unless someone requests.