[erlang-questions] KATT multiplies floats by a factor of 10 or 100.

Bjarne Wichmann Bagge Petersen bp@REDACTED
Thu Jan 18 08:51:11 CET 2018


Have this head scratcher where I apply a float to a KATT parameter but in
the request that float have been inflated by a factor of 10 or 100.

I am wondering whether I am missing something obvious about how to treat
floats in katt/jsx/erlang? Or this is a KATT bug?

Got this minimal test case:

float_test(Config) ->
    File = filename:join([?config(data_dir, Config), "float_test.apib"]),
    Params = [ {test_float, 1.23}],
    katt:run(File, Params).

And the contents of float_test.apib:

POST http://localhost:9999
> Accept: application/json
> Content-Type: application/json
> User-Agent: KATT
{
    "test": "{{<test_float}}",
    "reference": 1.23
}
< 200
< Content-Type: application/json
{}

And this is how the request looks using nc -l 9999

POST / HTTP/1.1
Accept: application/json
Content-Type: application/json
User-Agent: KATT
Host: localhost:9999
Content-Length: 43

{
    "test": 12.3,
    "reference": 1.23
}

As you can see "test_float" have been multiplied by a factor 10.


Best regards


Bjarne Wichmann Bagge Petersen

Backend Developer, ShopGun


E: bp@REDACTED
L: dk.linkedin.com/in/bjarnewp
W: shopgun.com
A: Arne Jacobsens Allé 16, Field's, 3rd floor, DK-2300 København S, Denmark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180118/7728ce07/attachment.htm>


More information about the erlang-questions mailing list